I think the correct way in K3 is via a plugin (not sure if the old /tags/
folder still works)
In my site I overwritten both (link:
and (image:
tags.
A good starting point is something like this
Kirby::plugin('manu/zendo', [
# Overwrite the default (image:) tag
'image' => [
# All the available attributes
'attr' => [
'alt',
'caption',
// All the other attributes
],
# Generate and return some html
'html' => function ($tag) { // Some code here }
]
]
I used the native (image:)
code as a starting point.
EDIT: here’s a link where you can find more information about extending kirbytags https://getkirby.com/docs/reference/plugins/extensions/kirbytags
EDIT PART 2: Only now realised you want to keep the old one as a fallback. Not really sure you can do that natively, unless you re-implement the old code as a fallback inside the “new” tag itself
EDIT PART 3: I was looking at your old code and I think an alternative could be to simply replace part of the native image tag rather than storing the entire original implementation. Because if the goal is to implement an image coming from the CDN, you still want to keep the same code for the remaining part (caption, alt attributes, likes and all that stuff.)