Get asset mime_type in Antlers

Hey there,

I'm trying to output an assets mime_type, as it's stored in its meta data, but can't figure out how to access meta.

In the following template I want the type attribute of the second <source> element to match the mime_type of the uploaded file (as it's stored correctly in the file's ./meta/file.ext.yaml:

{{ footer:cta_image }}
    <picture>
        <source
            srcset="{{ glide:url width="300" height="300" format="webp"}}"
            type="image/webp"
        >
        <source
            srcset="{{ glide:url width="300" height="300" }}"
            type="{{ meta.mime_type }}"
        >
        <img
            width="200"
            height="200"
            class="w-[200px] h-[200px]"
            src="{{ glide:url width="300" height="300"}}"
            alt="{{ alt }}"
        >
    </picture>
{{ /footer:cta_image }}

But neither meta nor mime_type are set. It's a mystery to me, that alt, size and last_modified seem to be magically available, but mime_type is not.

>>>>>>> Unanswered <<<<<<<
2 Replies
2 Followers