Here I give the transformation that the output is supposed to deliver – the magic of Imagick helps me. In my view I now call an image with this call:
<?= $asset->getThumbnail('exampleCover')->getHtml(); ?>
Now I get the image in the size I defined in the template in the frontend. Pimcore has created a temporary image file in the background, which corresponds to the according specifications.
You can also configure the image directly in the code by specifying the desired transformers such as size or quality.
<?= $this->image('myImage', [
'title' => 'Drag your image here',
'width' => 200,
'height' => 200,
'thumbnail' => [
'width' => 200,
'height' => 200,
'interlace' => true,
'quality' => 90
]
]); ?>
API information can also be found in the Pimcore developer documentation. There you will also find a table with the various transformation options.
Now we have the image in the right format, but we all know the problem: Depending on the device and its screen resolution, the images look different. Especially with picture motives with people, heads are often cut off. Also in the case of product photos, the focus should be on the article and not on cropping it. Solutions for this problem are often complicated to implement or not at all within an affordable budget.
But Pimcore wouldn't be Pimcore if it didn't have a convenient solution.