file upload - PHP GD .ico handling -


users of php webapp permitted upload png , jpeg images. upload algorithm following:

  1. check extension file name parsing
  2. check extension getimagesize()
  3. recreate image imagecreatefrompng()/imagepng() (imagecreatefromjpeg()/imagejpeg())
  4. rename image
  5. save filesystem

image recreation used security. works fine. need algorithm handle .ico files. seems gd doesn't work .ico (there no function imagecreatefromico()), don`t know how implement step 3 of algorithm.

thanks or advice.

see https://github.com/lordelph/icofileloader composer-installable class can load .ico files gd image.

for example:

$loader = new elphin\icofileloader\icofileservice; $im = $loader->extracticon('/path/to/icon.ico', 32, 32); 

see documentation other methods of analysing , extracting images icon file.


Comments

Popular posts from this blog

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -