Reputation: 37
I have app Upload images to firebase and I want check if image 720p HD or no because I want show user only available 720p or 1080p.
If anyone know how to do this please let me know.
Upvotes: 1
Views: 202
Reputation: 1435
Use this extention method if you have an UIImage
extension UIImage {
func isImageHD() -> Bool {
let heightInPoints = self.size.height
let heightInPixels = heightInPoints * self.scale
return heightInPixels >= 720
}
}
you can use this where you have the UIImage
let image = // Your image
if image.isImageHD() {
// Upload Image
} else {
// Show Pop up or something
}
Upvotes: 1