Reputation: 23
Users of my PHP webapp are permitted to upload PNG and JPEG images. Upload algorithm is following:
Image recreation is used for security. Everything works fine. But now i need this algorithm to handle .ico files. It seems like GD doesn't work with .ico (there is no function like imagecreatefromico()), so i don`t know how to implement step 3 of my algorithm.
Thanks for any help or advice.
Upvotes: 2
Views: 1535
Reputation: 300825
See https://github.com/lordelph/icofileloader for a composer-installable class which can load .ico files into a GD image.
For example:
$loader = new Elphin\IcoFileLoader\IcoFileService;
$im = $loader->extractIcon('/path/to/icon.ico', 32, 32);
See documentation for other methods of analysing and extracting images from the icon file.
Upvotes: 2