Copied to clipboard

Flag this post as spam?

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


  • Doobear 21 posts 111 karma points
    Jun 21, 2017 @ 14:58
    Doobear
    0

    Dynamic Media not working

    Hi, I am having trouble with getting an image from a media picker. I am fairly new to Umbraco but the last site a created with Umbraco 7 I used simply ... @Umbraco.Media(CurrentPage.BackgroundImage).GetCropUrl("banner")

    however trying this is the latest version, the url is always blank. When I debug and view the properties everything seems to be in order.

    enter image description here

    Even the url /media/1051/testimage.jpg displays the correct image.

    The crop is setup in the ImageCropper and definitely the correct name. I have also tried without cropping and that still doesn't work.

    I'm sure it'll be something very simple but any advice would be very welcome.

    Thanks

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jun 21, 2017 @ 15:16
    Alex Skrypnyk
    0

    Hi Sarah

    What version of Umbraco are you using?

    If you use > 7.6 version, try to use like here:

    @CurrentPage.BackgroundImage.GetCropUrl("banner")

    Since 7.6 Property Value Converters are part of the core, so you don't need to use extra Umbraco.Media call.

    Thanks,

    Alex

  • Doobear 21 posts 111 karma points
    Jun 22, 2017 @ 08:00
    Doobear
    0

    Thanks Alex.

    I am using the latest version 7.6.3.

    I have tried using your suggestiong but ended up with the error ...

    Umbraco.Web.Models.PublishedContentWithKeyBase' does not contain a definition for 'GetCropUrl'

    However if I use just @CurrentPage.BackgroundImage.Url the image is at least loading so phew for that but do you have any idea why I can't use GetCropUrl()

    Thanks again. Sarah

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies