PHP GD图标输出
是否可以让库输出一个文件PHP GD图标输出,php,image-processing,icons,gd,favicon,Php,Image Processing,Icons,Gd,Favicon,是否可以让库输出一个文件 有类似的功能吗?为什么不使用netpbm的ppmtowinicon程序?GD->file(xbm)->file(ppm)->file(ico)->php流,content type=image/ico。您只需将内容类型设置为“image/png”,并将图标链接引用设置为生成图标的php脚本,就可以完成此操作 $img = imagecreatetruecolor(16, 16); $blue = imagecolorallocate($im, 100,
有类似的功能吗?为什么不使用netpbm的ppmtowinicon程序?GD->file(xbm)->file(ppm)->file(ico)->php流,content type=image/ico。您只需将内容类型设置为“image/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);
如果您是为favicon执行此操作,则输出为PNG可能会很好地工作=)因此,已经介绍了这一点,如下所示: