Copied to clipboard

Flag this post as spam?

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

  • Ondřej Kobza 15 posts 95 karma points
    Oct 08, 2019 @ 22:39
    Ondřej Kobza

    How to get url from the image cropper

    Hello guys.. I'm trying to figure out how to get the URL of the uploaded image from the image cropper (not any of the pre-made crops, but the whole image) in Razor.

    I've been using this:


    When I use this with the @ symbol inside of an HTML tag, it returns just the URL. That works fine for me.

    BUT when I use this inside of a block of code and try to assign it to a variable, it returns a lot of other stuff with it (focal points, all the crops and so on)..

    I absolutely don't understand what's going on and why. How can I SIMPLY get a URL of an image.

    This is what I'm trying to do:

     if (@Model.TemplateId == 1167)
        imageUrl = String.Format("{0}?width=1280&height=640&mode=pad", Model.Value("image"));

    I don't have the models builder setup and I'm using Umbraco 8.1.2

  • Shaishav Karnani from 348 posts 1627 karma points
    Oct 09, 2019 @ 06:43
    Shaishav Karnani from


    Please can you try.

    imageUrl = String.Format("{0}?width=1280&height=640&mode=pad", Model.Value<iPublishedContent>("image").Url);

    Hope this helps to solve the issue.



  • Ondřej Kobza 15 posts 95 karma points
    Oct 09, 2019 @ 12:06
    Ondřej Kobza

    With this code I get an error:

    The type or namespace name 'iPublishedContent' could not be found (are you missing a using directive or an assembly reference?)

  • Ondřej Kobza 15 posts 95 karma points
    Oct 09, 2019 @ 21:31
    Ondřej Kobza

    This cool guy helped me in a Facebook group, so I have a solution.

    using Umbraco.Core.PropertyEditors.ValueConverters
    imageCropUrl = String.Format("{0}?width=1280&height=640&mode=pad", Model.Value<ImageCropperValue>("image").Src);
Please Sign in or register to post replies

Write your reply to: