-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added favicon size to google provider #13
base: master
Are you sure you want to change the base?
Added favicon size to google provider #13
Conversation
Added favicon_size to config file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged a DuckDuck Provider in the meantime. I think it makes sense to add those favicon sizes to all providers as well.
config/favicon-extractor.php
Outdated
/* | ||
|-------------------------------------------------------------------------- | ||
| Favicon Provider | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This value is used for requesting a favicon of the given size (if supported by the given provider) | ||
| | ||
*/ | ||
|
||
'favicon_size' => 32, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Favicon Provider | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This value is used for requesting a favicon of the given size (if supported by the given provider) | ||
| | ||
*/ | ||
|
||
'disk' => 'public', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to put those values below the provider_class configuration with a simple description. It looks weird to me to have duplicate "favicon provider" headlines. The description above the disk is also wrong cause it's just copied from the favicon size.
src/Provider/GoogleProvider.php
Outdated
$favicon_size = config('favicon-extractor.favicon_size', 32); | ||
$size_query = '&sz='.$favicon_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables please in camelCase faviconSize
, sizeQuery
Moved config variables between provider and generator
unavatar is interesting because it resolves a domain, username or email to image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good. Just those little three modifications and I'll merge it 👍🏻
private function getUrl(string $url): string | ||
{ | ||
$faviconSize = config('favicon-extractor.favicon_size', 32); | ||
$sizeQuery = $faviconSize.'/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line-break before return
@@ -18,6 +18,8 @@ public function fetchFromUrl(string $url): string | |||
|
|||
private function getUrl(string $url): string | |||
{ | |||
return 'https://www.google.com/s2/favicons?domain='.urlencode($url); | |||
$faviconSize = config('favicon-extractor.favicon_size', 32); | |||
$sizeQuery = '&sz='.$faviconSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line-break before return
// size options are limited to 16 & 32 | ||
$faviconSize = config('favicon-extractor.favicon_size', 32) > 16 ? 32 : 16; | ||
$sizeQuery = '?size='.$faviconSize; | ||
return 'https://favicon.yandex.net/favicon/'.urlencode($url).$sizeQuery; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line-break before return
Sorry for the delay, I missed somehow this PR. |
Added favicon_size to config file