This
Fork of PHP Favicon Grabber
use a given url, save a copy (if wished) and returns the image path, and also gives the title.
This Isn't My Project This Is A Fork - My Changes
- Grabs Title
- &format=json gives you it in JSON
- Saves it it /metadata-storage/
- Grabs the biggest image, if that fails then we grab the favicon.
Make it better for Loogle+, that's about it.
- Check if the favicon already exists local or no save is wished, if so return path & filename
- Else load URL and try to match the favicon location with regex
- If we have a match the favicon link will be made absolute
- If we have no favicon we try to get one in domain root
- If there is still no favicon we randomly try google, faviconkit & favicongrabber API
- If favicon should be saved try to load the favicon URL
- If wished save the Favicon for the next time and return the path & filename
$url = 'example.com';
$grap_favicon = array(
'URL' => $url, // URL of the Page we like to get the Favicon from
'SAVE'=> true, // Save Favicon copy local (true) or return only favicon url (false)
'DIR' => './', // Local Dir the copy of the Favicon should be saved
'TRY' => true, // Try to get the Favicon frome the page (true) or only use the APIs (false)
'DEV' => null, // Give all Debug-Messages ('debug') or only make the work (null)
);
echo '<img src="'.grap_favicon($grap_favicon).'">';
Optional split the download dir into several sub-dirs (MD5 segment of filename e.g. /af/cd/example.com.png) if there are a lot of favicons.