1

I'm loading images on a list from a server. The UIImageView size is very small (40 x 40), So ideally an image with a size of 40 x 40 or a little larger should be loaded in it. However, the server guy is sending an image of a much larger size (1920 x 1200).

When I diagnosed the view controller memory I noticed that it increases as the image is loading.

So my question is

  • Will the Kingfisher library download a smaller size version of the image?

  • Will it abort the image loading if the image size is too big?

Is there any way by which can I specifically achieve the above task.

Kingfisher: https://github.com/onevcat/Kingfisher

Pochi
  • 13,391
  • 3
  • 64
  • 104
TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

3

Will the Kingfisher library download a smaller size version of the image?

Nor Kingfisher nor any other library will download a smaller version of an image. The server has to send you a smaller version of it. (different url, or same url with a parameter)

Will it abort the image loading if the image size is too big?

I don't know how the library implements the downloading but unless you are talking about unreasonably big files (way bigger than the resolution you expect (1920x1200)) it will not be aborted. And even then, it probably won't be aborted but instead the app might be killed by the system when displaying super high resolution images (again, way bigger than 1920 x 1200)

Is there any way by which can I specifically achieve the above task.

If you want to display many many images at once and are worried about their sizes, its better to create thumbnails of them.

You can use Kingfisher to

1) first download the image

2) then resize the image

3) then show and cache it if you need

Check this page to see a ton of code snippets for that library.

https://github.com/onevcat/Kingfisher/wiki/Cheat-Sheet

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
Pochi
  • 13,391
  • 3
  • 64
  • 104