[SOLVED] Getting the file ending of an asset


(Matthias Lang) #1

Hey there,

I have a NodeType with a property of type Asset. The user is able to upload a video with this NodeType.
Is there a possibility to get the file ending of the uploaded video directly inside the template?

<video>
  <source src="{f:uri.resource(resource: media.resource)}" type="video/{media.whateverStandsForFileEnding}">
</video>

Thanks for the help!


(Soren Malling) #2

You should be able to use mediaType(media.resource.mediaType) - it holds the full IANA media type


(Matthias Lang) #3

Thanks @sorenmalling, it works great!