Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How do i find a media image by it's name from code?
Can I ask why you want to get it by name ? Names can be changed by editors and that way your code breaks.
Also maybe you can explain what your are trying to achieve. Maybe there is another solution to your requirement.
I have to display a image with a certain name. The editor knows that the image won't be displayed unless it's named correctly
Why don't you add a media picker to your doctype. That way the editor can change the image and you can get it by Id ?
Dave
So it's not possible to get a media file by its name i guess.
It is possible. I just won't recommend it. One editor may now that he can not change the name, but another one can forget and change it and break the site
In uQuery there is a method to get media by name.
See documentation : http://our.umbraco.org/documentation/Reference/Querying/uQuery/Media
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting a mediafile by its name
How do i find a media image by it's name from code?
Can I ask why you want to get it by name ? Names can be changed by editors and that way your code breaks.
Also maybe you can explain what your are trying to achieve. Maybe there is another solution to your requirement.
I have to display a image with a certain name. The editor knows that the image won't be displayed unless it's named correctly
Why don't you add a media picker to your doctype. That way the editor can change the image and you can get it by Id ?
Dave
So it's not possible to get a media file by its name i guess.
It is possible. I just won't recommend it. One editor may now that he can not change the name, but another one can forget and change it and break the site
In uQuery there is a method to get media by name.
See documentation : http://our.umbraco.org/documentation/Reference/Querying/uQuery/Media
Dave
is working on a reply...