Copied to clipboard

Flag this post as spam?

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


  • Jeroen Vantroyen 54 posts 394 karma points c-trib
    Oct 15, 2019 @ 16:06
    Jeroen Vantroyen
    0

    Image.Url always empty. Correct way to access it?

    Hi,

    I've written an APIcontroller (inheriting from UmbracoApiController) that fetches some items. One of their properties is an Image.

    In the V7 version, Image.Url would yield the Url for the image.

    In the V8 version, this Url is always empty.

    Some extra info:

    • In ModelsBuilder, I do "this.Value<IPublishedContent>("image")", but the Url is empty.
    • If I use the image's Id, I can do "var image = Current.UmbracoHelper.Media(a.Image.Id)", but the Url is always empty.
    • I could maybe use a.Image.UmbracoFile.Src, because it is the same as the url (/media/1004/truckers-guide-agw-photo1.jpeg), but it feels wrong to just assume that.

    Why would this be empty every time?

  • Dhanesh Kumar MJ 158 posts 511 karma points c-trib
    Jun 19, 2020 @ 13:34
    Dhanesh Kumar MJ
    0

    Hey,

    Did you fix this?

  • Jeroen Vantroyen 54 posts 394 karma points c-trib
    Jun 23, 2020 @ 10:03
    Jeroen Vantroyen
    100

    Turns out it was my own fault.

    I had been experimenting with GoldenGate (a uSync extension to convert from Umbraco 7 to Umbraco 8), and one of my custom properties in the Image MediaType was set to VaryByCulture.

    Umbraco doesn't support variations on MediaTypes (yet?), so somewhere under the hood this caused a problem.

    If you are experiencing a similar problem, I highly doubt the reason is the same.

Please Sign in or register to post replies

Write your reply to:

Draft