0

I'm loading a 95KB image, dimensions 1024x683 using Universal Image Loader. When I'm on wireless, the image loads just fine. However, if I turn off wireless and use the phone's network, it downloads the image at 305x203.

This is my config:

// setup the image async loader
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
    .cacheInMemory()
    .cacheOnDisc()
    .build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
    .defaultDisplayImageOptions(defaultOptions)
    .build();
ImageLoader.getInstance().init(config);

This is the download:

ImageLoader.getInstance().displayImage(imageUrl, imageView, new SimpleImageLoadingListener() {
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
        super.onLoadingComplete(imageUri, view, loadedImage);
        android.util.Log.v("image size", String.valueOf(loadedImage.getWidth())+" x "+String.valueOf(loadedImage.getHeight()));
    }
});

I've tried removing cacheInMemory. I've tried using loadImage and specifying a target size, but it still downloaded at the smaller size. I tried changing the image scale type, using NONE and EXACTLY, no change.

I feel like I'm missing something obvious, but I can't figure it out.

Harry
  • 3,116
  • 2
  • 23
  • 20

1 Answers1

1

Dunno exactly what the UniversalImageLoader actually does, but maybe it is responsible. You can find out by downloading the image with a normal AndroidHttpClient connection with both connection types (WiFi and mobile) and then comparing their actual size.

This phenomenon can also happen due to a reformatting proxy of your network operator, that detects your mobile device's user agent and scales down the image without your knowledge or request. I know this sounds odd, but those things happen. You can find out of this is the case, but trying a different provider (change sim cards) or by trying to change the settings of your http user-agent (pretend to be a full blown desktop firefox).

Good luck!

usb79
  • 115
  • 3
  • Good call on checking for these things. I just tried a BufferedInputStream to directly grab the file, and the result was the full size image on both wifi and mobile. – Harry Mar 14 '13 at 19:26