Theming: Generate favicon sizes to avoid resizing issues done by the browser
fixes #5193 Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
parent
8e61ad8847
commit
31b9fc9eac
|
@ -56,13 +56,34 @@ class IconBuilder {
|
||||||
*/
|
*/
|
||||||
public function getFavicon($app) {
|
public function getFavicon($app) {
|
||||||
try {
|
try {
|
||||||
$icon = $this->renderAppIcon($app, 32);
|
$favicon = new Imagick();
|
||||||
|
$favicon->setFormat("ico");
|
||||||
|
$icon = $this->renderAppIcon($app, 128);
|
||||||
if ($icon === false) {
|
if ($icon === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$icon->setImageFormat("png32");
|
$icon->setImageFormat("png32");
|
||||||
$data = $icon->getImageBlob();
|
|
||||||
|
$clone = clone $icon;
|
||||||
|
$clone->scaleImage(16,0);
|
||||||
|
$favicon->addImage($clone);
|
||||||
|
|
||||||
|
$clone = clone $icon;
|
||||||
|
$clone->scaleImage(32,0);
|
||||||
|
$favicon->addImage($clone);
|
||||||
|
|
||||||
|
$clone = clone $icon;
|
||||||
|
$clone->scaleImage(64,0);
|
||||||
|
$favicon->addImage($clone);
|
||||||
|
|
||||||
|
$clone = clone $icon;
|
||||||
|
$clone->scaleImage(128,0);
|
||||||
|
$favicon->addImage($clone);
|
||||||
|
|
||||||
|
$data = $favicon->getImagesBlob();
|
||||||
|
$favicon->destroy();
|
||||||
$icon->destroy();
|
$icon->destroy();
|
||||||
|
$clone->destroy();
|
||||||
return $data;
|
return $data;
|
||||||
} catch (\ImagickException $e) {
|
} catch (\ImagickException $e) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -71,6 +71,9 @@ class IconBuilderTest extends TestCase {
|
||||||
if (count($checkImagick->queryFormats('SVG')) < 1) {
|
if (count($checkImagick->queryFormats('SVG')) < 1) {
|
||||||
$this->markTestSkipped('No SVG provider present.');
|
$this->markTestSkipped('No SVG provider present.');
|
||||||
}
|
}
|
||||||
|
if (count($checkImagick->queryFormats('PNG')) < 1) {
|
||||||
|
$this->markTestSkipped('No PNG provider present.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataRenderAppIcon() {
|
public function dataRenderAppIcon() {
|
||||||
|
|
Loading…
Reference in New Issue