Images not rendering on Contao 5.3.9
xApep opened this issue · 2 comments
xApep commented
Hey.
I'm using Contao 5.3.9 and RSCE Custom Elements 2.4.10.
In template I have been doing like this (in past Contao versions).
` <?php $gallery = unserialize($this->multiSRC); foreach ($gallery as $imageId): ?>
<?php $image = $this->arrData['getImageObject']($imageId); ?>
<?php dump($image); ?>
<?= $this->figure($image->src, '_image_1'); ?>
<?php endforeach ?>`
then in config.yml
`contao:
image:
sizes:
image_1:
width: 120
resize_mode: box
lazy_loading: true
formats:
jpeg: [webp, jpeg]
jpg: [webp, jpg]
png: [webp, png]
webp: [webp, jpg]
`
But "figure" is not generated in frontend. When dumping image->src, path is valid. This also is not working for singleSRC.
Not sure if the problem is in my configuration for Contao 5 or there is a bug in RSCE for Contao 5?
Thanks.
ausi commented
You should use the ID directly for creating the figure and skip the getImageObject()
call:
<?= $this->figure($imageId, '_image_1'); ?>
xApep commented
You are true MVP, it works.
Thank you 🥇