For any given site "example.domain.tld" or merely "domain.tld" I need to do the following in PHP:
Any ideas? I'm being stumped by the unreliable fileformat and location of the favicons, but if at all possible I want to avoid downloading the entire source of the page with file_get_contents in order to find it in the headers. Also converting to png seems nontrivial.
Thanks,
Mala
A favicon can actually be either a PNG, GIF, or ICO file. However, ICO files are typically used more than others as the file size is smaller and it is supported in all major browsers. PNGs are used more commonly for IOS, Android, and Windows 10 devices.
ico format anymore (even though browsers do support . ico still). Favicons' format is always . png .
SVG would be nice, but is not supported by all browsers. So the easiest solution is still to just use PNG images. Google explicitly says they don't support 16x16 or 32x32 icons. For Google results, you need to include at least one icon that is a multiple of 48x48.
As is typical, I found a passable solution shortly after asking the question - let google do the work for you:
http://www.google.com/s2/favicons?domain=URL
returns a 16x16 png
Found this: http://www.controlstyle.com/articles/programming/text/php-favicon/
I'm about to try it for my project and I'll report back and tell you if it works!
Cheers
Iain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With