Copied to clipboard

Flag this post as spam?

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


  • Mark Evans 86 posts 116 karma points
    Nov 10, 2014 @ 17:48
    Mark Evans
    0

    image getcropurl error

    im adding a image reference in my partial view 

    @foreach (var child in subpage.Children.Where("Visible"))
                                    {
                                        if (child.HasValue("divisionSliderImage")) // check if there is an image for this page
                                        {
                                           <div style="height: 87px; width: 280px;"><img src="@Umbraco.TypedMedia(@child.GetPropertyValue("divisionSliderImage")).GetCropUrl(280, 87)"/></div>
                                        }
                                    } 

    but getting this error

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

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 10, 2014 @ 17:58
    Jan Skovgaard
    0

    Hi Mark

    What version of Umbraco 7 are you using?

    And have you consulted the documentation on how to fetch images using the cropper etc. here http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Image-Cropper ?

    Hope this helps.

    /Jan

  • Mark Evans 86 posts 116 karma points
    Nov 11, 2014 @ 09:56
    Mark Evans
    0

    thanks we upgraded to the latest version recently so yes its 7.0 something....

    this code does work on another page which is odd....

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 11, 2014 @ 10:03
    Jan Skovgaard
    0

    Hi Mark

    Ok, so are you using a 3rd party package cropping images? The cropper was not built in untill the release of 7.1 if I remember correctly so the link I posted may not work as a reference then.

    And is that other installation running the exact same version of Umbraco 7?

    /Jan

  • Mark Evans 86 posts 116 karma points
    Nov 11, 2014 @ 12:08
    Mark Evans
    0

    yes same site and yes its in in-built cropping package within umbraco

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 11, 2014 @ 16:49
    Jan Skovgaard
    0

    Hi Mark

    Ok - Does the @child.GetPropertyValue("divisionSliderImage") part of the code return an id if you just try to write out that part? And does the expression work if you just hardcode the image id just to see if it's something with the value fetched for the id that is wrong? I suspect it might be empty?

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft