Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Added favicon size to google provider #13

wants to merge 6 commits into from

Conversation

jayenne
Copy link

@jayenne jayenne commented Oct 11, 2021

Added favicon_size to config file

Copy link
Owner

@stefanbauer stefanbauer left a 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.

Comment on lines 4 to 25
/*
|--------------------------------------------------------------------------
| 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',

Copy link
Owner

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.

Comment on lines 21 to 22
$favicon_size = config('favicon-extractor.favicon_size', 32);
$size_query = '&sz='.$favicon_size;
Copy link
Owner

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

jayenne and others added 3 commits October 21, 2021 17:28
Moved config variables between provider and generator
unavatar is interesting because it resolves a domain, username or email to image.
Copy link
Owner

@stefanbauer stefanbauer left a 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.'/';
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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

@stefanbauer
Copy link
Owner

Sorry for the delay, I missed somehow this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wishlist: google provider to include sz=nn parameter for sizing & Storage to include disk
2 participants