Hi,
I would like to create a PHP script that convert a png file to an ico file. Is it possible to do it just with PHP ? How ?
Thanks !!!
Hi,
I would like to create a PHP script that convert a png file to an ico file. Is it possible to do it just with PHP ? How ?
Thanks !!!
There is no easy way to do this directly though php built in libraries. To write an ico file, you will need to write individual bits and bytes by hand to suit the file format. The easiest way would be to use a third party library.
phpthumb is a good tool for this.
This seems to suggest Imagick can do this.
Otherwise, you could do the conversion on the server using an external tool and server the .ico file. Tools to achieve this have been analyzed in Stack Overflow before (well, doing the opposite transformation, but I bet most of that software can do what you need).
After some googling and light experimentation, it appears that an .ico file is basically a BMP with another file extension. I believe the ICO format supports more resolutions in one file, but a BMP seems to constitute a minimal ICO file. You should be able to generate BMP files easily with gd or ImageMagick.