Image focus and srcset

Hi,
I am a big fan of setting the image focus and right now I am updating older website code. I am using the following code to display images. Although I don’t define the crop origin the focus of the image is not used. Any ideas why?

<img
	alt="<?= $image->alt() ?>"
	src="<?= $image->thumb(['width' => 380, 'height' => 254, 'quality' => 80, 'crop' => 'true', 'quality' => 80])->url() ?>"
	srcset="<?= $image->srcset(
		[
			'1x'  => ['width' => 380, 'height' => 254, 'crop' => 'true', 'quality' => 80],
			'2x'  => ['width' => 760, 'height' => 508, 'crop' => 'true', 'quality' => 80],
			'3x'  => ['width' => 1140, 'height' => 762, 'crop' => 'true', 'quality' => 80],
		])?>"
	width="<?= $image->thumb(['width' => 380, 'height' => 254, 'quality' => 80, 'crop' => 'true'])->width() ?>"
	height="<?= $image->thumb(['width' => 380, 'height' => 254, 'quality' => 80, 'crop' => 'true'])->height() ?>"
	class="img-fluid"
>

The focus settings will be automatically applied if crop is set to true, but you are setting it to a string true not a boolean.

1 Like

Thanks!!!