Skip to content

Commit

Permalink
Merge pull request #16 from zans-laksa/2434-lighthouse-pwa
Browse files Browse the repository at this point in the history
2434 lighthouse pwa
  • Loading branch information
carinadues authored Jul 13, 2021
2 parents b5b51c0 + 1b50c44 commit c9e9fb6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Controller/AppIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class AppIcon

const STORAGE_PATH = 'favicon/icons/';

const MASKABLE_IMAGE_SIZE = 192;

const IMAGE_RESIZING_CONFIG = [
'ios' => [
'type' => 'ios',
Expand Down Expand Up @@ -122,10 +124,12 @@ public function getIconData ()
$height = is_array($size) ? $size[1] : $size;
$name = 'icon_' . $config['type'] . '_' . $width . 'x' . $height;
$src = '../' . self::STORAGE_PATH . $name . '.png';
$purpose = $width === self::MASKABLE_IMAGE_SIZE ? 'any maskable' : 'any';
$output[] = [
'src' => $src,
'type' => 'image/png',
'sizes' => $width . 'x' . $height
'sizes' => $width . 'x' . $height,
'purpose' => $purpose
];
}
}
Expand All @@ -150,7 +154,7 @@ public function getIconLinks ()
$height = is_array($size) ? $size[1] : $size;
$size = $width . 'x' . $height;
$name = 'icon_' . $config['type'] . '_' . $width . 'x' . $height;
$href = '/pub/media/' . self::STORAGE_PATH . $name . '.png';
$href = '/media/' . self::STORAGE_PATH . $name . '.png';
$output[$type][$size] = [
'href' => $href,
'sizes' => $size
Expand Down

0 comments on commit c9e9fb6

Please sign in to comment.