From 52420b8715625fdda606e4cf47eaad94cfa0ae03 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 ''; } /**