使用 gd 和 php 制作 .ico 文件
有谁知道如何制作可在 Intenet explorer 中使用的 .ico 文件? 我似乎哪儿也去不了 这是我的 gd 代码
$im = imagecreatefromjpeg(FAVICONDIR.'normal/'.$filename );
list($width, $height) = getimagesize(FAVICONDIR.'normal/'.$filename); // get the width and height of the jpg
$image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with
imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16
imagepng($image_p,FAVICONDIR.'icons/'.$ico_filename); // make a .png file (icon file) from our data
imagedestroy ($im); // close gd library
和图像魔法的尝试
/*$cmd = IMAGEMAGIKDIR .''. FAVICONDIR.'normal/'.$filename . ' -transparent white -background white -flatten -resize 16x16 ico:'.FAVICONDIR.'icons/'.$ico_filename;
exec($cmd);*/
任何想法都会很棒。
Does anyone know how to make a .ico file that will work in Intenet explorer?
I can't seem to get anywhere
here is my gd code
$im = imagecreatefromjpeg(FAVICONDIR.'normal/'.$filename );
list($width, $height) = getimagesize(FAVICONDIR.'normal/'.$filename); // get the width and height of the jpg
$image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with
imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16
imagepng($image_p,FAVICONDIR.'icons/'.$ico_filename); // make a .png file (icon file) from our data
imagedestroy ($im); // close gd library
and an attenpt with image magick
/*$cmd = IMAGEMAGIKDIR .''. FAVICONDIR.'normal/'.$filename . ' -transparent white -background white -flatten -resize 16x16 ico:'.FAVICONDIR.'icons/'.$ico_filename;
exec($cmd);*/
Any ideas would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果遇到问题,请使用 png2ico 这是一个很棒的教程
http://myutil.com/2007/10/14/favicon-ico-瘸子
理查德
Use png2ico if you run into problems this is a great tutorial
http://myutil.com/2007/10/14/favicon-ico-gimp
Richard