Split Image::getImageUrls from Image::getInlineImage

This commit is contained in:
Aaron van Geffen 2022-07-05 12:01:02 +02:00
parent edfad992cc
commit 2bcdc5fe6e

View File

@ -67,7 +67,7 @@ class Image extends Asset
return EXIF::fromFile($this->getPath());
}
public function getInlineImage($width = null, $height = null, $className = 'inline-image')
public function getImageUrls($width = null, $height = null)
{
$image_urls = [];
if (isset($width) || isset($height))
@ -79,6 +79,13 @@ class Image extends Asset
else
$image_urls[1] = $this->getUrl();
return $image_urls;
}
public function getInlineImage($width = null, $height = null, $className = 'inline-image')
{
$image_urls = $this->getImageUrls($width, $height);
return '<img class="' . $className . '" src="' . $image_urls[1] . '" alt=""' .
(isset($image_urls[2]) ? ' srcset="' . $image_urls[2] . ' 2x"' : '') . '>';
}