How do I get asset id?
subratom opened this issue · 2 comments
subratom commented
I am generating download URLs for the content. Assets are embedded inside of content, how do I get asset id from the file name?
nfourtythree commented
Although the functionality at the moment doesn't cater for being passed a filename (although that is a good idea), you can get the ID of an asset in template tags by doing the following
{% set assetId = craft.assets({ filename: "my-filename.txt" }).first().id %}
subratom commented
Thank you that worked!