[2.0.x] Fixed checking case insensitive image extensions
[2.0.x] Fixed checking case insensitive image extensions

Also fixed a bug using imagepng instead of imagejpeg to create png images

From pull request #10141
Zaszczyk/cphalcon,Zaszczyk/cphalcon,Zaszczyk/cphalcon,Zaszczyk/cphalcon