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
When I use the media picker it only out puts the ID of the image and not the URL.
My question is what is the use of Media Picker when it cannot generate the URL
Many thanks in advance
Media items are in some ways very similar to content nodes. They resolve to an IPublishedContent which has all sorts of properties.
The Media Picker behaves in the same way as the Content Picker in that internally it only stores the ID of the node that has been selected.
Then, if you have property converters enabled, you should be able to retrieve the values as IPublishedContents. Off the back of this you can get the URL, as well as any other properties you have added, such as Alt-Text if it's an image. Author if it's a document etc.
The Pickers only store the ID's so that when you use that ID value to retrieve the IPublishedContent to get the URL you are always getting the latest published URL.
The URL of media can be changed from within the media section, so if you had a media picker on your home node that picked a hero image and you selected "Media item A". At this point in time Media Item A, might point to /media/1001/MyHeroImage.jpg at that point in time. However, you might go into the media section, updated Media Item A to point to /media/1230/MyNewHeroImage.png. If the Media Picker on the home page had stored the URL, it would now either be showing the wrong image, or no image. By storing the ID when you render it out, you will get the most current url.
Does that help?
I am a no-voice, new bee.
Can you please give an example to get the URL from the media picker please
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted