Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Mar 28, 2014 @ 14:20
    Claushingebjerg
    0

    A couple of cropper questions...

    As documentation about the new cropper is a bit hard to find i have a couple of questions, someone might be able to answer

    1. is it possible to use unnamed crops using dimensions instead. Kinda' like cropup did it?

    @image.GetCropUrl("umbracoFile", 200x200)


    2. Does the new cropper cache the crops on disk?

    3. Is it possible to disable upscaling on the crop?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Mar 28, 2014 @ 14:37
    Jeavon Leopold
    101
    1. Yes, if you are using a strongly typed IPublishedContent, you can do @image.GetCropUrl(100,100) (assumes umbracoFile)
    2. Yes
    3. Yes , @image.GetCropUrl(width: 100, height:100, furtherOptions: "&upscale=false")

    If you are using Dynamics (CurrentPage), it's slightly different, I can provide examples if you let me know

    You need to be using the latest nightly for these options to work correctly http://nightly.umbraco.org/umbraco%207.1.0/

    I will write the documentation next week :-)

  • Claushingebjerg 939 posts 2574 karma points
    Mar 28, 2014 @ 14:39
    Claushingebjerg
    0

    AWESOME! Thanks

    Dynamic examples would be nice though :)

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Mar 31, 2014 @ 19:34
    Jeavon Leopold
    1

    Ok, here is an example of how to access the GetCropUrl method that has every option while using dynamics

    @{
        var homePage = CurrentPage.AncestorsOrSelf(1).First();    
    }
    <!-- Features -->
    <section class="is-features">
        <h2 class="major"><span>Wonderful featured pages</span></h2>
        <div>
            <div class="row">
                @foreach (var feature in homePage.umbTextPages.Where("featuredPage"))
                {                    
                    <div class="3u">
                        <!-- Feature -->
                        <section class="is-feature">
                            <a href="@feature.Url" class="image image-full">             
                                <img src="@ImageCropperTemplateExtensions.GetCropUrl(mediaItem: feature, propertyAlias:"Image", width: 100, height: 100, furtherOptions: "&upscale=false")" alt="" />
                            </a>
                            <h3><a href="@feature.Url">@feature.Name</a></h3>
                        </section>
                        <!-- /Feature -->
                    </div>
                }
            </div>
        </div>
    </section>
    
  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Mar 31, 2014 @ 19:38
    Jeavon Leopold
    0

    Of course most of time you do not need this options so you can just do the following with dynamics:

    <img src="@feature.GetCropUrl("home")" alt="" />
    <img src="@feature.GetCropUrl("umbracoFile","home")" alt="" />
    

    First one assumes your Cropper property alias is "umbracoFile", second one you can use when it is called something else e.g. <img src="@feature.GetCropUrl("image","home")" alt="" />

  • 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