Copied to clipboard

Flag this post as spam?

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


  • Shuchita 41 posts 150 karma points
    Feb 23, 2023 @ 09:48
    Shuchita
    0

    After upgrading Umbraco 7 to 11 unable to get media picker value in template.

    I have upgraded Umbraco 7 to Umbraco 11. I got one issue after upgrade. Media Picker is still showing legacy. Due to this I am not able to get value in template. I supposed it will change legacy to media picker v3 but it is still old version (Umbraco.MediaPicker)

    I can not delete this property because I have thousands of images selected on the content nodes.

    I have tried with media picker v3 data type manually but then image not showing in media picker as selected in the content nodes.

    I have tried this way to get value: https://our.umbraco.com/Documentation/Fundamentals/Backoffice/property-editors/built-in-property-editors/media-picker/ but not working.

    Is there way to get old media picker value on the template? Or if can change data type to media picker v3 without loss of any selected images?

    Thank you.

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Mar 01, 2023 @ 23:18
    Marc Goodson
    0

    Hi Shuchita

    I'm not sure which version of the Media Picker your data is stored in post migration?

    Is it still ints? Or are they Udis?

    I think if it is ints you are meant to migrate to Udis before migrating to V11 etc. But tgats not super helpful now!

    Anyway if you access the media picker in the method you link to then it will be running the request to get the data through a PropertyValueConverter

    That takes the raw data and gets the media object for the picked udi or int and returns a helpful IPublishedContent item representing the picked image...

    In the modern version of Umbraco its not expecting the data in the format you have it in...

    There are several things you can do, but to answer your question you should be able to access the raw stored value bypassing the property value converter in the template...

    By getting the properties I Property Value and reading its published value

    IPublishedProperty? prop = contentItem.GetProperty(propertyAlias); var rawValue = prop. PublishedValue;

    Or

    Implement your ownPropertyValueConverter for the legacy picker

    Maybe create a new Media Picker to property and loop through all content and migrate old value from legacy data to modern data...

    Anyway seeing the raw value in the template will give you options!

    Regards

    Marc ..

Please Sign in or register to post replies

Write your reply to:

Draft