views:

28

answers:

2

Is it possible to have the PHP GD library output a .ico file?

Is there a function similar to imagepng?

+2  A: 

Why not to use netpbm's ppmtowinicon program? GD -> file(xbm) -> file(ppm) -> file(ico) -> php stream, content-type = image/ico.

mhambra
Please explain...
Mark
+1  A: 

you should be able to do it simply by setting the content type to 'image/png' and setting the the icon link ref to the php script that generates the icon

    $img = imagecreatetruecolor(16, 16);
    $blue = imagecolorallocate($im, 100, 100, 255);
    imagefill($im, 0, 0, $blue);

    header('Content-type: image/png');
/*
or if it needs to be the icon content type
    header('Content-type: image/ico');
*/
    imagepng($im);
    imagedestroy($im);
Patrick