0

Whats the most effective way of dealing with different image resolutions in Parse for the different ios devices?

For instance

  1. Would it be better to have 1 image in parse at the highest res and download for every device? (slower download speeds for lower res devices)

  2. Have 1x 2x and 3x versions of the image in Parse and download for relevant device. (takes up more storage space on Parse)

  3. Run cloud code on Parse to resize the images to their correct resolution as they are downloaded to the devices. (possible slower download speed for all devices?)

Any other options anyone can think of would be welcome.

Al

rici
  • 234,347
  • 28
  • 237
  • 341
Al Martin
  • 179
  • 3
  • 15

1 Answers1

0

I would say this strongly depends on the usage case. For example, if you have a profile picture, I would recommend uploading it in 2-3 versions, as those pictures may be downloaded very often (for example in a social networking app where you have profile pictures in posts, user profiles, messages, etc.). When the picture is downloaded a high amount of times, you would rather download a smaller one to minimise download time and save parse data transfer resources.

On the other hand, for pictures that aren't downloaded as often as other ones, I'd recommend storing them in a high-res format, and scaling them down (if necessary) as they are downloaded. Take for example again a social networking app. A post contains a profile picture (which is downloaded quite often) and the actual post (a photo in this case). The actual post photo is only downloaded a single time (ideally), so there should be no reason to worry about the download speed.

Basically (and that's the way I handle this), you should always try to cache every image. Images that can be cached easily and don't have to be retrieved very often can be stored in a single high-res format (saving data space on parse). Images that cannot be cached easily or have to be refreshed quite often, should be stored in different sizes, which will, in the end, save you data transfer. The small amount of extra storage does not have that much impact, to be honest, especially if you store them in scaled down sizes.

eschanet
  • 1,063
  • 6
  • 15
  • Thanks for your insight. This has helped me decide how to handle this. I'm intrigued about the caching, is this something that parse has in their resources? Or is it something that should be done at the app end through coding? – Al Martin Jun 26 '15 at 06:07
  • Parse offers some basic caching when it comes to images. It is pretty straight forward, for every `PFQuery`you can define a cachePolicy: `query.cachePolicy = kPFCachePolicyCacheThenNetwork` (for example). This example first retrieves the results for this query from the cache, then checks against the network. There are plenty of other possibilities, please check their [docs](https://parse.com/docs/ios/guide#queries-caching-queries) for further information. – eschanet Jun 26 '15 at 07:57