rotr rotr - 2 months ago 10
Swift Question

Disable large UIImages for UIImageView

One core feature from my app is that the User can use his own images.
But the image size should be restricted to certain size. For example the User shouldn't be allowed to load panorama pictures in the imageView. What would be the best way to restrict this?

Should I just do an if statement after the imagePickerController? And what would be a good maximum size?


You can check the image.size property, and then perform calculations against that to check for excessive size, or ratios you do not support.

For example, panoramic images tend to have 2,3 or even 4:1 ratios of width to height, which would make them easy to detect.