8

Migrated from a Slack #help channel question


Jason Mayo [09:53 16/6/15]

Is there anyway to output what file type an assets file is? E.g. if its a Jpeg, SVG or Gif etc.

12

Yes, you can access a number of properties on assets. You can get the "file group" (whether it's a document, image, video etc) using:

{{ asset[0].kind }}

More specifically, you can access the file extension using:

{{ asset[0].extension }}

Full list in the documentation at: http://buildwithcraft.com/docs/templating/assetfilemodel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.