Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Jul 20, 2017 @ 14:48
    k
    0

    Image cropper not working

    Hello,

    I am using image cropper in umbraco 7.6.3. However the image is not displaying.

    I am using the code formthe documentation :

    https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/image-cropper

        @{
    <img src="@Url.GetCropUrl(Model.Content, "uploadBanner", "large")" />
    }
    

    But the image is not rendering.

    Can someone please help.

    Thanks,

    kusum

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 20, 2017 @ 14:52
    Alex Skrypnyk
    0

    Hi Kusum

    What about this code:

                                    @{
                                        var image = Model.Content.GetPropertyValue<IPublishedContent>("uploadBanner");
                                    }
                                    <img src="@image.GetCropUrl("large")" />
    
  • k 256 posts 654 karma points
    Jul 21, 2017 @ 10:38
    k
    0

    Hello Alex ,

    <img src="/media/1083/banner-treasury.jpg?crop=0.034850484229366221,0.0000000000000001329726204864,0.21835342514135769,0&amp;cropmode=percentage&amp;width=1259&amp;height=598&amp;rnd=131450499270000000">
    

    I am getting the image as the above and it is not diplaying.However when I remove evrything after the " ? " , the image is visible.

    I do not understand why because on the previous umbraco instance it was the same and the image did appear.

    Can you please help.

    Thanks,

    kusum

  • John Bergman 483 posts 1132 karma points
    Jul 21, 2017 @ 21:23
    John Bergman
    0

    How about this

    Model.Content.GetPropertyValue

  • k 256 posts 654 karma points
    Jul 24, 2017 @ 05:55
    k
    0

    Hello John,

    The code is not working. I am geting an error :

    Compiler Error Message: CS1061: 'object' does not contain a definition for 'First' and no extension method 'First' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
    

    Can you please help.

    Thanks,

    kusum

  • k 256 posts 654 karma points
    Jul 24, 2017 @ 11:38
    k
    100

    I got it working using :

    if (Model.Content.HasValue("uploadBanner"))
    

    {

    <img src="@Url.GetCropUrl(Model.Content, propertyAlias: "uploadBanner", height: 598, width: 1259)" />
    

    }

Please Sign in or register to post replies

Write your reply to:

Draft