I use Glide to download and display the image, however, when I tried to resize the image, it does not. I get a random size (or maybe its actual image size).
Here is the code I used to download through Glide
Glide.with(context) .load(file.getUrl()) .asBitmap() .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .transform(new CropCircleTransform(context)) .override(dimen, dimen) .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { bitmap = resource; Log.info(resource.getWidth() + "x" + resource.getHeight()); } });
the CropCircleTransform simply displays the circular and central cropping of the bitmap. I tried to remove it simply to check if this method caused a problem, but still the image does not change to fit the specified size.
Is there something wrong with my code? or i don't understand the override method here?
EDIT:
Tried to remove the redefinition and seems to have uploaded the image in large sizes, so this means that the actual resizing occurs when using the override.
Why doesn't it resize the actual value that I specified?
EDIT:
As a sample, the value for dimen is 96, but the size displayed in the log for images is 97x97, 117x117, 154x154, etc.
Does this mean that the value for the override method is the base value for the resize, and not the actual dimension that will be used?
source share