LampCMS development and php tips

Announcements and articles about this site development and stuff like that

Favicon extractor using php
Sat Dec 5 2009
Need to write class to extract favicon from web page. Given a url it will check for <link rel=icon or whatever is used to indicate the favicon thing...

If it does not exist it will try to get favicon.ico from ur's root

Just not sure what should be the order of doing it: checking favicon.ico first OR look in the page's HTML for link rel thingy?

It will then try to get the actual favicon file to see if it exists and return the url or actual binary file of it.

Another class may be used to convert it to different format like gif but that's really isn't necessary because all browsers are capable of displaying the .ico image.

It will be usefull for rss parser scripts - an item can have a small favicon next to it, making it clear which site the item came from. Sometimes it's very easy to recognize a familiar favicon so a user will know right away which site the article came from.

What would be the best way to store the favicon? As a file or in a database? Also should store the timestamp when the favicon was last downloaded or when we last checked for it. This is because a website may update or add add a favicon, so we must keep our data updated also...

Once this class is ready I can shared it as open source stand-alone class