mchome / flutter_advanced_networkimage

flutter advanced network image provider
https://pub.dev/packages/flutter_advanced_networkimage
MIT License
285 stars 180 forks source link

Download image with specified size #112

Closed ManojMM026 closed 5 years ago

ManojMM026 commented 5 years ago

I would like to download an image with a specified size, In my case, I have very big images around 2450X1440 resolution. For Grid and list, I don't need a full size, I would like to load thumbnail of it lets say around 200X200. Please let me know how can I achieve it here.

mchome commented 5 years ago

@ManojMM026 Replace your url with low res image.

ManojMM026 commented 5 years ago

@mchome No, I cannot do that. user upload image from his device, It needs to be high res image. But while showing in the list I can afford to show it as a thumbnail.

I am from the android background and new to Flutter, I know in Glide lib(Android native) I can provide width and height of an image to be downloaded from the server no matter size of the original image,It gives me provided size image, I am not able to find the same in flutter, And in my grid if I scroll with around 30 images or so it gets crashed.

erf commented 5 years ago

I think your questions is out of the scope of this library. What you should do is use some kind of image resize service which creates a set of different image sizes and returns a json with a set of urls, which you request on demand. You could use the Image package to resize the hi res image once you download it, but it would be very slow to download and resize many high res images.

ManojMM026 commented 5 years ago

@erf any suggestions for such a service?

erf commented 5 years ago

@ManojMM026 nah. i made one for myself. but a quick google search for 'image resize service' will show you some alternative. depends on your needs.

mchome commented 5 years ago

@ManojMM026 Try to use https://api.flutter.dev/flutter/widgets/GridView/GridView.builder.html.

If this is server problem, ask the backend dev for help. If this is ram problem, see https://github.com/flutter/flutter/issues/28682.