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

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -