1

是否可以让PHP GD库输出.ico文件?

有没有类似的功能imagepng

4

2 回答 2

2

您应该可以通过将内容类型设置为“图像/PNG”并将图标链接引用设置为生成图标的 php 脚本来实现

    $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);
于 2010-09-08T02:02:48.070 回答
0

为什么不使用 netpbm 的 ppmtowinicon 程序?GD -> 文件(xbm) -> 文件(ppm) -> 文件(ico) -> php 流,内容类型 = image/ico。

于 2010-09-07T23:49:06.200 回答