Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    May 24, 2012 @ 18:24
    Anthony Candaele
    0

    two crops for a mediatype

    Hi,

    I have defined a custom mediatype (ArrangementImage)

    for this custom mediatype I would like to define two crop properties:

    sliderimage crop : this has a width of 600 px
    image crop: this has a width of 300 px

    However when I give a custom media type two crop properties of different crop datatypes, I get an YSOD

    Or is there a better way to organize this.

    The scenario I want to enable is an image with two different crops, one crop with a with of 600px (used for a slider) and another crop of 300px (just a static image for a page)

    Thanks for the advice,

    Anthony

  • Tom Fulton 2030 posts 4996 karma points c-trib
    May 24, 2012 @ 18:31
    Tom Fulton
    2

    Hi Anthony,

    You can define multiple crop sizes in a single Image Cropper datatype - no need to add two separate datatypes.  When you do this, you'll see several boxes at the bottom of the image, each representing the crop you've defined in the prevalues, and you can click each one to set them separately.

    -Tom

  • Anthony Candaele 1197 posts 2049 karma points
    May 24, 2012 @ 20:26
    Anthony Candaele
    0

    Hi Tom,

    Problem solved! 

    Thanks,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Mar 23, 2014 @ 10:48
    Anthony Candaele
    0

    I'm trying to define two Crops for a media type. One with the dimensions of 250x418 and one with the dimensions of 300x267

    However when I select an image with DAMP (v2.7), two crops are stored:

    <behandelingCrop>
      <crops date="2014-03-23T10:32:26">
        <crop name="behandelingCrop" x="0" y="0" x2="159" y2="267" url="/media/1027/b-active-gamma_behandelingCrop.jpg" />
        <crop name="behandelingCrop" x="0" y="0" x2="300" y2="267" url="/media/1027/b-active-gamma_behandelingCrop.jpg" />
       </crops>
     </behandelingCrop>
    

    enter image description here

    Is there a way for editors to choose just one of the defined crops?

    Thanks for your help,

    Anthony

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Mar 26, 2014 @ 07:24
    Tom Fulton
    1

    I think due to the DAMP_CallImageCropper setting in your Web.config file, DAMP will automatically create the empty crops. You can try setting this to false, but it means crops won't be created unless the editor explicitly creates them in the UI (if I recall).

  • Chriztian Steinmeier 2724 posts 8278 karma points MVP 4x admin c-trib
    Mar 26, 2014 @ 10:15
    Chriztian Steinmeier
    1

    Hi Anthony,

    I may not completely understand your scenario, but the way we've always used the various croppers is to define the various crops needed for displaying the images as banners, page images etc.

    The client just picks a single image to go with a page, or a contact/newsitem etc. and our code picks the correct crop required for the situation - the client never picks a specific crop for any purpose. They just know how to adjust a crop if it looks wrong.

    Using the CropUp package makes this a thousand times easier because it's pretty good at finding faces and "focus points" in images, so the default crops are pretty useful already.

    /Chriztian

  • Anthony Candaele 1197 posts 2049 karma points
    Mar 30, 2014 @ 15:07
    Anthony Candaele
    1

    Hi Chriztian,

    The problem I have, is that for the same page, sometimes different crops are needed, based on the image itself. Sometimes the image needs to be shown with landscape proportions, and sometimes with portrait proportions.

    Jeroen Breuer affirmed me that there is no way to let an editor choose which crop to show on the page (although I think that would be a great feature). But he gave me a tip for a workaround.

    So I created a datatype of dropdownlist with to propertyvalues: portrait, landscape

    Then in the backoffice the editor can choose wich crop to use by selecting a value in the dropdownlist:

    enter image description here

    Then In the code, I just use a condition to decide which crop to use:

    ...
    var scale = Model.Content.GetPropertyValue("imageScale");
    if (scale.ToString() == "landscape")
    {
      <img class="polaroid" src="@image.First.TypedCrops["behandelingcrop"]" alt="@image.First.Alt" />
    }
    else {
      <img class="polaroid" src="@image.First.TypedCrops["behandeling2crop"]" alt="@image.First.Alt" />
    }
    

    just tried it out and it works fine.

    greetings,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Mar 30, 2014 @ 15:13
    Anthony Candaele
    0

    @Tom, Hi Tom, your solution might be appropriate as well. The problem is that I have properties that only use one crop. So I guess if I set the DAMP_CallImageCropper property to 'false' in web.config. The editor would need to explicitely select a crop, even for those image for which only one crop is available.

    greetings,

    Anthony

Please Sign in or register to post replies

Write your reply to:

Draft