As it says in the comment it's a helper method. This means you need to call the method yourself. Here is a sample you can use in the media before save event:
if (propUmbracoFile != null && (propUmbracoFile.Value != null || !string.IsNullOrEmpty(propUmbracoFile.Value.ToString()))
{
//Crop the images automatically without having to press the save button first.
DAMP_Helper.CallImagecropper(sender.Id);
}
}
catch (Exception ex)
{
LogException(ex);
}
The above code is a sample if you use the umbracoFile upload field for cropping. This before save event also works without using DAMP as a media picker. I could add this code into DAMP as well, but I had a little discussion about this. Here are the e-mails:
Email 1:
DAMP now has a helper to call the image cropper so you don't need to press the save button, but currently this is only a helper and you need to manually programm the before save event and call it in there. Should I include the before save event in the code? This would mean the image cropper would always be called (only if it's empty) in the before save event. Is this a good idea or should I leave this choice to the developers? I don't think it would hurt if I also included the before save event.
Email 2:
Ok I already ran into a problem where the DAMP events are fired before my own events and I can only call the image cropper helper method after my own events are fired. So I guess it's best to let the developer call the image cropper helper method himself instead of already implementing it in the DAMP before save event :).
It's recommended to use the latest change set since I already added some improvements to the CallImageCropper method, however this new version is still in development so there are still some bugs.
How to make cropping work ?
Can anyone tell me how to make image cropping work with DAMP ?
http://damp.codeplex.com/SourceControl/changeset/changes/72398
I have a regular Media with the Image Cropper datatype attached.
On my document I then use DAMP as my picker, but the crops are still not created unless I hit Save twice in the media section.
What am I doing wrong ?
Hello,
As it says in the comment it's a helper method. This means you need to call the method yourself. Here is a sample you can use in the media before save event:
The above code is a sample if you use the umbracoFile upload field for cropping. This before save event also works without using DAMP as a media picker. I could add this code into DAMP as well, but I had a little discussion about this. Here are the e-mails:
Email 1:
DAMP now has a helper to call the image cropper so you don't need to press the save button, but currently this is only a helper and you need to manually programm the before save event and call it in there. Should I include the before save event in the code? This would mean the image cropper would always be called (only if it's empty) in the before save event. Is this a good idea or should I leave this choice to the developers? I don't think it would hurt if I also included the before save event.
Email 2:
Ok I already ran into a problem where the DAMP events are fired before my own events and I can only call the image cropper helper method after my own events are fired. So I guess it's best to let the developer call the image cropper helper method himself instead of already implementing it in the DAMP before save event :).
It's recommended to use the latest change set since I already added some improvements to the CallImageCropper method, however this new version is still in development so there are still some bugs.
Jeroen
is working on a reply...