I am having trouble getting images by name. craft.assets.first()
function in assets gives the proper output of one image.
But when I try craft.assets.filename('flag.jpg')
, craft shows the following error:
Object of class Craft\ElementCriteriaModel could not be converted to string
Same with other functions of assets. Please help me solve this error.
Thank You.