From 357d95f6ffe41b0c9ef2b8958cd1d3da975fb6af Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Thu, 30 Jun 2022 15:22:08 +0200 Subject: [PATCH] Add Image::getInlineImage method --- models/Image.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/models/Image.php b/models/Image.php index c8205f83..a43df139 100644 --- a/models/Image.php +++ b/models/Image.php @@ -67,14 +67,18 @@ class Image extends Asset return EXIF::fromFile($this->getPath()); } - public function getPath() + public function getInlineImage($width = null, $height = null, $className = '') { - return ASSETSDIR . '/' . $this->subdir . '/' . $this->filename; - } + 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); + else + $image_url = $this->getUrl(); - public function getUrl() - { - return ASSETSURL . '/' . $this->subdir . '/' . $this->filename; + return ''; } /**