Image is loaded again if width is different in transformation?
Hi everyone,
I'm using Cloudinary in an iOS app.
On one ViewController, I'm loading image "A" with a width of say 700. When the user taps the image, he's taken to product details page where image "A" needs to be displayed again, with a width of say 750.
Does this mean the image is being loaded again (not taken from the cache), hence making two separate network requests?
Current behavior in my app seems to say so - the same image is loading again, and not displayed immediately.
Is there a way around that? i.e loading the image once, with the maximum size used in all screens, and adapt size based on each screen's requirement.
Thanks for the help!
-
In the use-case that you provided, we will do two network requests. In order to avoid it, you can get the larger image e.g, w_750 and use one of the caching libraries. For example https://github.com/Haneke/HanekeSwift
The advances of choosing to get the larger image is that you will call the server only once and after the first time all the derived images will load faster.
Please note that when getting a large file it will take more time and if most of your users are using only smaller images that might cost unnecessary bandwidth use.
If you want, you're more than welcomed to open a ticket and we'll be happy to suggest specific tips for you regarding optimizing your images while saving bandwidth.
0
Post is closed for comments.
Comments
1 comment