I use the Kirby Starterkit in my installation and also use Blocks. When I place an image there and change the aspect ratio, the new format is displayed in the panel but not in the frontend.
Which controllers, templates etc. are responsible for the recalculation and should I check?
I have already changed quite a bit in my installation and it may well be that I have (unknowingly) deleted/changed something. Currently, I can’t find any approach in researching where the error lies.
Panel → Blocks:
Frontend:
The block snippets (and their styling or rather your styling, because Kirby doesn’t do any styling for you)
Somehow can’t link to the website atm…
Ok, working again-
Here you can find all default blocks with their blueprints, snippets and Panel previews: Blocks | Kirby CMS
I copied the examples from the references page 1:1.
In the panel everything works perfectly too. But in the frontend the images keep the original format.
At which point could I still go troubleshooting?
The snippet, you need to create your own with cropping/resizing, srcsets and the required front-end styles. Kirby doesn’t do any of this for you, because the default block snippets are really just examples. A lot of this image stuff depends on the context, for example, images sizes in a multi-column layout need to behave differently from image sizes of a full-size block.
While the default image snippet has those data attributes, these are just for styling (but without styling provided), and don’t help much with regards to actually creating those images in the right sizes.
Thanks for the info. I always learn something new.
Maybe I did not explain my problem clearly: I used the starter kit as a basis for my installation. There "ratio"
and "crop"
work fine - unfortunately not with me.
In the .txt everything looks fine for me, too:
{"location":"kirby","image":["file://NZsO55B0w1xZT74w"],"src":"","alt":"","caption":"","link":"","ratio":"3/2","crop":"true"}
Where/how are the images processed in the starter kit? The function must already be built in there, if this is not the case by default.
As I said, each default block comes with a snippet (see links above). This snippet is used when you render $page->yourBlocksField()->toBlocks()
in your template (for example, in the Starterkit in the note.php
template, you see <?= $page->text()->toBlocks() ?>
.
I think it helps if you read the docs about blocks, starting in the guide: Page builder | Kirby CMS
I took a closer look at the Starterkit → Notes → Note and only now saw that the images are “cropped” with CSS and the original remains untouched. Since I use the Bootstrap framework, the effect was not visible for me.