Handling image sizes/crops in Markdown fields

Hello,

I’m sure there’s a good answer/approach to this, but I’m not sure what it is or exactly what I should be looking for.

I’m using the markdown-field plugin, and want to be able to include images in posts, which works fine, but only including them at the full size at which they’re uploaded.

So if I have (image: example.jpg) I get the image file at full resolution.

I can obviously style it in CSS, and include classes with (image: example.jpg class: styleone), but is there a way to use Kirby’s resize or crop facilities on images within these fields? Say if I wanted to make sure images were only 800 pixels wide, or if I wanted a particular image or class of images to be cropped to square?

Or am I better just cropping/resizing as desired prior to upload?

You can extend the image Kirbytag to your needs, e.g. add additional attributes like srcset or crop, and then change the code.

Thank you, I’ll experiment with that. If you know of any useful examples of the sort of thing beyond that documentation that would be helpful, otherwise I will just do my best to figure it out!

Take a look at the upcoming Kirby 4 Alpha code, where srcset will be implemented by default:

In the same way, you can implement other attributes.

Thank you :slight_smile: