diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-01-27 09:29:09 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-01-27 09:29:09 +0100 |
commit | 73f65c8fbadbdd2098448e77b6d3f0464ad8613e (patch) | |
tree | f22ba63a222fb4f7d05427b661f3c008170047fd /vendor/fguillot/picofeed/docs/favicon.markdown | |
parent | be37aed9f5d923fe16e264c6ffc97db08503b791 (diff) |
update picofeed
Diffstat (limited to 'vendor/fguillot/picofeed/docs/favicon.markdown')
m--------- | vendor/fguillot/picofeed | 0 | ||||
-rw-r--r-- | vendor/fguillot/picofeed/docs/favicon.markdown | 81 |
2 files changed, 0 insertions, 81 deletions
diff --git a/vendor/fguillot/picofeed b/vendor/fguillot/picofeed new file mode 160000 +Subproject 0a1d0d3950f7f047dc8fb1d80aa6296e15f306d diff --git a/vendor/fguillot/picofeed/docs/favicon.markdown b/vendor/fguillot/picofeed/docs/favicon.markdown deleted file mode 100644 index 1ac3ee1fc..000000000 --- a/vendor/fguillot/picofeed/docs/favicon.markdown +++ /dev/null @@ -1,81 +0,0 @@ -Favicon fetcher -=============== - -Find and download the favicon ------------------------------ - -```php -use PicoFeed\Reader\Favicon; - -$favicon = new Favicon; - -// The icon link is https://bits.wikimedia.org/favicon/wikipedia.ico -$icon_link = $favicon->find('https://en.wikipedia.org/'); -$icon_content = $favicon->getContent(); -``` - -PicoFeed will try first to find the favicon from the meta tags and fallback to the `favicon.ico` located in the website's root if nothing is found. - -- `Favicon::find()` returns the favicon absolute url or an empty string if nothing is found. -- `Favicon::getContent()` returns the favicon file content (binary content) - -When the HTML page is parsed, relative links and protocol relative links are converted to absolute url. - -Get Favicon file type ---------------------- - -It's possible to fetch the image type, this information come from the Content-Type HTTP header: - -```php -$favicon = new Favicon; -$favicon->find('http://example.net/'); - -echo $favicon->getType(); - -// Will output the content type, by example "image/png" -``` - -Get the Favicon as Data URI ---------------------------- - -You can also get the whole image as Data URI. -It's useful if you want to store the icon in your database and avoid too many HTTP requests. - -```php -$favicon = new Favicon; -$favicon->find('http://example.net/'); - -echo $favicon->getDataUri(); - -// Output something like that: data:image/png;base64,iVBORw0KGgoAAAANSUh..... -``` - -See: http://en.wikipedia.org/wiki/Data_URI_scheme - -Check if a favicon link exists ------------------------------- - -```php -use PicoFeed\Reader\Favicon; - -$favicon = new Favicon; - -// Return true if the file exists -var_dump($favicon->exists('http://php.net/favicon.ico')); -``` - -Use personalized HTTP settings ------------------------------- - -Like other classes, the Favicon class support the Config object as constructor argument: - -```php -use PicoFeed\Config\Config; -use PicoFeed\Reader\Favicon; - -$config = new Config; -$config->setClientUserAgent('My RSS Reader'); - -$favicon = new Favicon($config); -$favicon->find('https://github.com'); -```
\ No newline at end of file |