I’ve got this srcset code that works fine generally. The images are cropped to a fixed landscape format.
<img srcset="
<?= $projekt->images()->sortBy('sort')->first()->srcset([
'400w' => ['width' => 400, 'height' => 300, 'crop' => 'center', 'quality' => 80],
'800w' => ['width' => 800, 'height' => 600, 'crop' => 'center', 'quality' => 80]
]) ?>"
alt="<?= $projekt->images()->sortBy('sort')->first()->title() ?>"
/>
However if the source image is smaller than the output format, the image is apparently not cropped. In this case my user uploaded a source image with 640×480px, which seems to slip through the 800w-definition and is rendered in landscape mode thus:
One way to solve this would probably be to require a minimum size for the image. But can I also force a crop or maybe even a »blowup« of the image in order to get a landscape image?
Thanks for any hints!