Skip to content

Commit 39666e4

Browse files
committed
Add retina on main image
1 parent 2164204 commit 39666e4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ViewModel/ImageResize.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ public function getImage(string $imagePath, int $width, int $height, array $para
110110
}
111111
}
112112

113+
if ($retina) {
114+
$imageUrl = $this->resize->resizeAndGetUrl($imagePath, $width * 2, $height * 2, $resize);
115+
$mainImageUrl = $placeholderImageUrl . ' 1x, ' . $imageUrl . ' 2x';
116+
}
117+
113118
$html .= '<img alt="' . $alt . '" title="' . $title . '" class="' . $class . '" src="' . $placeholderImageUrl . '" data-src="' . $mainImageUrl . '" />';
114119
$html .= '</picture>';
115120

0 commit comments

Comments
 (0)