resize the main logo

This avoids downloading an oversized image
This commit is contained in:
Andreas Gohr 2019-03-13 14:06:29 +01:00
commit 1995880094

View file

@ -189,9 +189,10 @@ class Template {
* @param array $attributes * @param array $attributes
* @param int $w * @param int $w
* @param int $h * @param int $h
* @param bool $crop
* @return string * @return string
*/ */
public static function getResizedImgTag($tag, $attributes, $w, $h) { public static function getResizedImgTag($tag, $attributes, $w, $h, $crop = true) {
$attr = ''; $attr = '';
$medias = array(); $medias = array();
@ -214,7 +215,7 @@ class Template {
if($media === '') return ''; if($media === '') return '';
// replace the array // replace the array
$media = ml($media, array('w' => $w, 'h' => $h, 'crop' => 1), true, '&'); $media = ml($media, array('w' => $w, 'h' => $h, 'crop' => (int) $crop), true, '&');
$attributes[$attr] = $media; $attributes[$attr] = $media;
// return the full tag // return the full tag
@ -244,7 +245,7 @@ class Template {
'src' => array('wiki:logo-wide.png', 'wiki:logo.png'), 'src' => array('wiki:logo-wide.png', 'wiki:logo.png'),
'alt' => $title, 'alt' => $title,
), ),
0, 0 0, 50, false
); );
$mobile = self::getResizedImgTag( $mobile = self::getResizedImgTag(
'img', 'img',