From edfad992cca17ae7b90c29d7bb0bfc9247baa9ca Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 5 Jul 2022 11:41:40 +0200 Subject: [PATCH] Rewrite Image::getInlineImage to support double density displays --- models/Image.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/models/Image.php b/models/Image.php index a43df13..1f4f061 100644 --- a/models/Image.php +++ b/models/Image.php @@ -67,18 +67,20 @@ class Image extends Asset return EXIF::fromFile($this->getPath()); } - public function getInlineImage($width = null, $height = null, $className = '') + public function getInlineImage($width = null, $height = null, $className = 'inline-image') { - if (isset($width) && isset($height)) - $image_url = $this->getThumbnailUrl($width, $height, false); - elseif (isset($width)) - $image_url = $this->getThumbnailUrl($width, null, false); - elseif (isset($height)) - $image_url = $this->getThumbnailUrl(null, $height, false); + $image_urls = []; + if (isset($width) || isset($height)) + { + $thumbnail = new Thumbnail($this); + $image_urls[1] = $this->getThumbnailUrl($width, $height, false); + $image_urls[2] = $this->getThumbnailUrl($width * 2, $height * 2, false); + } else - $image_url = $this->getUrl(); + $image_urls[1] = $this->getUrl(); - return ''; + return ''; } /**