从PHP到PNG的Favicon [英] Favicon to PNG in PHP
问题描述
我需要一个PHP脚本将网站图标转换为PNG,同时保持其原始尺寸.
I need a PHP script to convert favicons to PNGs while keeping their original dimensions.
我知道Google有它的秘密图标转换器-> http: //www.google.com/s2/favicons?domain=http://facebook.com/,但这会将favicons转换为16x16,即使它们最初是较大的也是如此.所以基本上我需要这个,减去收缩效果.
I know Google has it's secret icon converter - http://www.google.com/s2/favicons?domain=http://facebook.com/ but this converts favicons to 16x16 even if they they were originally larger. So basically I need this, minus the shrinking effect.
我也看到了- http://www.controlstyle. com/articles/programming/text/php-favicon/,但经过数小时的混乱之后,我无法使它正常工作.
I've also seen this - http://www.controlstyle.com/articles/programming/text/php-favicon/ but I couldn't get it to work after hours of messing around with it.
基本上,我正在尝试自动获取尽可能大的链接的图标-基于URL自动48x48 png会是理想的情况,但是我不知道有任何人工方法可以做到这一点鉴于没有网站会在公共场所保留48x48图标.
Basically I am trying to automatically grab the icon for a link that will be as large as possible - automatically 48x48 png based on a URL would be the perfect scenario, but I don't know of any humanly possible way to do this given that no websites happen to keep a 48x48 icon in a publicly accessible spot.
有人知道脚本/服务或有建议吗?谢谢!
Does anybody know of a script/service or have a suggestion? Thanks!
推荐答案
因此,我最终使用了一个名为FloIcon的类,该类可以将BMP转换为ICO.我应该注意,检查图标的文件类型始终很重要,并且不要假设.ico表示bmp,因为某些网站(例如Facebook)实际上是PNG).
So I ended up using a class called FloIcon that could convert BMPs to ICO. I should note that it's always important to check the file type of an icon and not assume that .ico means bmp because some sites (like Facebook) were actually PNG).
@ goker.cebeci您的服务真棒!最主要的是,我需要在可能的情况下将图标的大小设为最大,因此我只编写了自己的脚本.
@goker.cebeci Your service looks awesome! The main thing is that I needed my icons to be the maximum size when possible, so I just wrote my own script.
这篇关于从PHP到PNG的Favicon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!