This is a simple Kirby 3 plugin to allow outputting optimised markdown images used in textarea fields with a KirbyTag.
The optimage tag is based on the default image kirbytag and has additional options which allow resizing, optimisation and native lazy-loading via the loading attribute.
Place the index.php plugin file in /plugins/optimage-tag/.
Add the optimagetag configuration options to your Kirby 3 config file located in /config/config.php.
In your markdown content field you can use the following options additionally to the default image options:
Resize by width or height, set the compression quality and set loading attribute.
Resize and output image with a width of 1000px
(optimage: image.jpg width: 1000)
Resize and output image with a width of 1000px and image quality of 50%
(optimage: image.jpg width: 1000 quality: 50)
Resize and output image with a height of 1000px and image quality of 50%
(optimage: image.jpg height: 1000 quality: 50)
Output image with the loading attribute set to lazy
(optimage: image.jpg loading: lazy)