开发者

Loading images from the server is very slow

I am trying to load images from the server and want to kno开发者_如何学Pythonw how can i convert the images into the thumbnails so that they get uploaded fast and how can i get the larger images from the thumbnails fast . I have tried many things.

Thanks in advance


At the server you need to keep 2 copies of an image. First is the thumbnail and the other one is the image. First you need to download the thumbnail asynchronously. And if the user wishes to see it then download the original image asynchronously. While downloading original image you can show the scaled thumbnail image as the placeholder image. So when the downloading is completed show the downloaded image. Make sure to download the images asynchronously otherwise you will block the main thread and UI will get stuck.

This is how google images work.

In iOS there is a very nice API SWPhotoBrowser which handles the downloading and caching of photos from the web seamlessly. I am sure there must be some API for Android as well.

If you need any help I can help with the code as well.


For Android you can use ImageLoader to download and display image - it can use cache and save memory while loading scaled images.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜