file upload - PHP GD .ico handling -
users of php webapp permitted upload png , jpeg images. upload algorithm following:
- check extension file name parsing
- check extension getimagesize()
- recreate image imagecreatefrompng()/imagepng() (imagecreatefromjpeg()/imagejpeg())
- rename image
- 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
Post a Comment