Add double-density support to photo thumbnails #28
@ -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 '<img class="inline-image ' . $className . '" src="' . $image_url . '" alt="">';
|
||||
return '<img class="' . $className . '" src="' . $image_urls[1] . '" alt=""' .
|
||||
(isset($image_urls[2]) ? ' srcset="' . $image_urls[2] . ' 2x"' : '') . '>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user