V3 Request: enable using the Asset tag in Markdown content to get original height/width for Photoswipe


I want to use Photoswipe to allow full-resolution zooming of thumbnails with blog posts. It needs to know the width/height of the linked image, but getting this in Statamic doesn't seem possible currently.

Ideal Solution

The Asset tag seems perfect for this: https://statamic.dev/tags/asset

This works in an Antlers template:

{{ asset src="/assets/blog/2011/11/18/central-park.jpg" }}
    <a href="{{ url }}" data-size="{{ width }}x{{ height }}">
        Zoom Me (thumbnail here)
{{ /asset }}

In Markdown content, I'm already referencing the asset by its path so that's perfect, but it doesn't work outside Antlers templates. Error:

TypeError: Argument 1 passed to Statamic\Assets\AssetRepository::find() must be of the type string, null given,

I found some issues touching on this need:

Feature Request

How can we make the Asset tag usable inside Markdown content (just like the Glide tag is)?


I can hardcode the image dimensions in my Markdown, but it seems really close to being avoidable.

>>>>>>> Unanswered <<<<<<<
4 Replies