Function file_validate_image_resolution() can receive $maximum_dimensions and/or $minimum_dimensions restrictions.
When both ($maximum_dimensions and $minimum_dimensions) are sent, it calculates the image width and height from the original file. Then it checks the the new image to see if $maximum_dimensions are fine, and if not, it scales the image (I'd like this behaviour to be optional, but it is out of this topic). After scaling the image, obviously both width and height are smaller than the original ones. Then it checks if the $minimum_dimensions are fine, but it doesn't recalculate the width and height from the new image, it checks the $minimum_dimensions against the original image dimensions, this is wrong.
Here is a little example:
- $maximum_dimensions = 1000x1000
- $minimum_dimensions = 500x500
- Original file dimensions = 3000 x 750
After checking $maximum_dimensions, it scales the image to fit there.
- Scaled image dimensions = 1000x250
After checking $minimum_dimensions (500x500) it shouldn't be validated because the new scaled image height (250) is smaller than the minimum height required (500), but it is validated because it is being compared with the original image height (750).
The solution is to recalculate the $info variable (that holds width and height information) with the information from the scaled image before to check $minimum_dimensions.