Is there a way with Damp to create more then one crop for an image. I need a smaller version of an image then the crop i defined for it, to appear in the featured section on the homepage.
DAMP doesn't know which crop is selected. If you define a crop in DAMP that is only to preview the crop. So if you decide to preview behandeling2crop in DAMP that is the image you'll see when you select images with DAMP. That' is the only thing it does. If you want to preview that crop in Razor you need to do it like this:
No not really. You could of course create a dropdown datatype and let the user choose a crop there. Than in your Razor code you use the value of the dropdown in your TypedCrops["behandeling2crop"] code.
DAMP: create more then one crop
Hi,
Is there a way with Damp to create more then one crop for an image. I need a smaller version of an image then the crop i defined for it, to appear in the featured section on the homepage.
thanks for your help and suggestions,
Anthony
Hello,
DAMP doesn't create crops. Those are other packages or the built in cropper. Which crop tool are you using?
Jeroen
Hi Jeroen,
I'm using the built in image cropper.
greetings,
Anthony
If you use the default image cropper why don't you just add a smaller crop version of the image on the datatype?
Jeroen
Hi Jeroen,
I created two crop versions:
But when I try to choose a crop for my document type, DAMP selects them both:
In umbraco.config it's looks like both crops are selected:
What I would like is that an editor can choose between the two crops and DAMP saves the selected crop.
greetings,
Anthony
Hello,
Crop names need to be unique so you can't name both crops behandelingCrop.
Jeroen
Hi Jeroen,
I see, but then, how do I read out the right crop from the Razor macro file, now my code for reading out the crop looks like this:
let's say I defined a second crop, behandeling2crop, how can I know which crop - behandelingcrop or behandeling2crop - was selected by the editor?
thanks for your help,
Anthony
I defined a second crop, for the same image cropper:
but when I select a crop with DAMP, both crops are stored in the umbraco.config file:
Hello,
DAMP doesn't know which crop is selected. If you define a crop in DAMP that is only to preview the crop. So if you decide to preview behandeling2crop in DAMP that is the image you'll see when you select images with DAMP. That' is the only thing it does. If you want to preview that crop in Razor you need to do it like this:
The editor selected behandeling2crop because that is defined as the crop preview in DAMP.
Jeroen
Oh, so there is no way to have 2 different crops of an image, and then let the editor decide which crop to use?
Thanks for your help,
Anthony
No not really. You could of course create a dropdown datatype and let the user choose a crop there. Than in your Razor code you use the value of the dropdown in your TypedCrops["behandeling2crop"] code.
Jeroen
Hi Jeroen,
I tried out your workaround and it works fine. I created a datatype of type dropdown with two property values: landscape and portrait:
Then in my Razor code, i use a condition to decide which crop to use:
thanks for the tip,
Anthony
is working on a reply...