Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • praveen 113 posts 164 karma points
    Apr 29, 2018 @ 10:34

    What is the use of Media Picker in Umbraco 7

    Hi there,

    Umbraco 7

    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

  • Nik 1522 posts 6752 karma points MVP 5x c-trib
    Apr 29, 2018 @ 11:42

    Hi Praveen,

    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?


  • praveen 113 posts 164 karma points
    Apr 30, 2018 @ 02:16

    Hi Nik,

    I am a no-voice, new bee.

    1. How do we enable property converters?
    2. How do we retrive the URL from the media picker with the ID. An example would be good please.

    Can you please give an example to get the URL from the media picker please

    Kind Regards

Please Sign in or register to post replies

Write your reply to: