Users of my PHP webapp are permitted to upload PNG and JPEG images. Upload algorithm is following:
- check extension by file name parsing
- check extension by getimagesize()
- recreate image by imagecreatefrompng()/imagepng() (imagecreatefromjpeg()/imagejpeg())
- rename image
- save to filesystem
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.