I would like to use an Image Cropper as a property in one of my Document Types. I have created a Media Picker property that selects the image that I want to crop, and then I added a new Image Cropper datatype that has the 'Property Alias' set to the alias of my Media Picker property. I then added the my new Image Cropper datatype as another property in my Document Type settings directly below the Media Picker it is tied to.
When I then go to my Content section and select a node of this document type, I see the media picker and the empty Image Cropper. So far, so good, but as soon as I select an image with my media picker and save the node, I get the error:
[ArgumentException: The relative virtual path '1090' is not allowed here.]
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +11416550
Any ideas on how I can make this work, or is this an unsupported way of using the Image Cropper.
I would much rather have the content editors select their crop rectangle in the document where the image will be used, as opposed to in the Media section like they do in the Image Cropper tutorial video.
I was eventually able to get it to work by changing my media picker to an upload control. It seems the cropper control is not compatible with the media picker set as the source. Not sure if you can apply some code into the cropper's 'Property Alias' field instead of a simple alias though, I did not try that.
However the c# snippet you posted is exactly what I needed to figure out how to work with the media once it was uploaded in the Razor macro.
Using an Image Cropper in a Document Type
Hello,
I would like to use an Image Cropper as a property in one of my Document Types. I have created a Media Picker property that selects the image that I want to crop, and then I added a new Image Cropper datatype that has the 'Property Alias' set to the alias of my Media Picker property. I then added the my new Image Cropper datatype as another property in my Document Type settings directly below the Media Picker it is tied to.
When I then go to my Content section and select a node of this document type, I see the media picker and the empty Image Cropper. So far, so good, but as soon as I select an image with my media picker and save the node, I get the error:
Any ideas on how I can make this work, or is this an unsupported way of using the Image Cropper.
I would much rather have the content editors select their crop rectangle in the document where the image will be used, as opposed to in the Media section like they do in the Image Cropper tutorial video.
Thanks!
Not actually used the image cropper, but looks like it's after a url as the input for the media location...
You might need to use
umbraco.library:GetMedia(id, deep)/umbracoFile
or if c# required
umbraco.cms.businesslogic.media.Media mediaXP = new umbraco.cms.businesslogic.media.Media(Id));
string url = mediaXP.getProperty("umbracoFile").Value.ToString();
I was eventually able to get it to work by changing my media picker to an upload control. It seems the cropper control is not compatible with the media picker set as the source. Not sure if you can apply some code into the cropper's 'Property Alias' field instead of a simple alias though, I did not try that.
However the c# snippet you posted is exactly what I needed to figure out how to work with the media once it was uploaded in the Razor macro.
Thanks!
Hi Mark,
FYI in uQuery there are helper extension methods on the Media and Node objects to return the urls for specific crops:
HTH,
Hendy
is working on a reply...