Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 pximage 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,
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.
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:
<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" />
Is there a way for editors to choose just one of the defined crops?
Thanks for your help,
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).
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.
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:
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" />
<img class="polaroid" src="@image.First.TypedCrops["behandeling2crop"]" alt="@image.First.Alt" />
just tried it out and it works fine.
@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.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted