I use DAMP for two projects now, and I start to love this package more and more.
One thing I didn't figure out yet: is it possible to configure a crop with only a width value? I want all my crops to have a width of 200px, the height should be an aspect ratio of the width
In the prevalue editor at the display option it says this:
Thumbnail Width / Height:
Desired width/height (pixels) of thumbnails to display in backend UI. Set either value to 0 to resize by one dimension. Thumbnails in the select or create dialog never have a bigger width/height than a 100 pixels.
So you can probably do this: 200 x 0. That ways all the images will have a width of 200px and the height will be an aspect ratio of the width.
I have defined a width of 200px and 0 for the Digibiz Advanced Media Picker datatype. But I have also defined an image cropper datatype 'eventCrop'. There I also set a width of 200 px and a height of 0:
in the content section my crop looks liks this:
However, on the website, the image looks out of scale:
So currently I don't know if I configured the image cropper datatype incorrect or if there is a problem with my html markup.
Another thing I'm not sure about, because I'm not completely familiar with the 'crop' concept, if is it was necessary to define an image cropper datatype at all.
I think the setup of the ImageCropper is wrong. It's a crop so it will be cropped in that size. Since you have a crop with 0px height that won't work. You'll need to pass a height crop or it won't work. You could disable the keep aspect checkbox so you can change it afterwards.
You defined a crop height of 200px. Even if the image height is only 103px it will be streched to 200px because that is the crop you want to have. You can't change this. DAMP can also be used without crops. Maybe the Cultiv Razor Examples has a sample without the Image Cropper and the DAMP Samples package also has a classic sample which uses no Image Cropper.
You can use that, but it doesn't store the full media xml, but only the id. You can enable this option in the prevalue editor and use it like the PDF example if you want to.
Well the media xml is stored inside the umbraco xml. Otherwise you only have an id and you need to get the media in razor or xslt. See this screenshot for how it looks.
I checked out the xml (I should do that more often), stored my property as Full media xml and than read out the information in my Razor script file (EventImage.cshtml) like this:
crop with only width value
Hi,
I use DAMP for two projects now, and I start to love this package more and more.
One thing I didn't figure out yet: is it possible to configure a crop with only a width value? I want all my crops to have a width of 200px, the height should be an aspect ratio of the width
Thanks for your advice,
Anthony
In the prevalue editor at the display option it says this:
Thumbnail Width / Height:
Desired width/height (pixels) of thumbnails to display in backend UI. Set either value to 0 to resize by one dimension. Thumbnails in the select or create dialog never have a bigger width/height than a 100 pixels.So you can probably do this: 200 x 0. That ways all the images will have a width of 200px and the height will be an aspect ratio of the width.
Jeroen
Hi Jeroen,
I have defined a width of 200px and 0 for the Digibiz Advanced Media Picker datatype. But I have also defined an image cropper datatype 'eventCrop'. There I also set a width of 200 px and a height of 0:
in the content section my crop looks liks this:
However, on the website, the image looks out of scale:
So currently I don't know if I configured the image cropper datatype incorrect or if there is a problem with my html markup.
Another thing I'm not sure about, because I'm not completely familiar with the 'crop' concept, if is it was necessary to define an image cropper datatype at all.
Thanks for your help,
greetings,
Anthony
I think the setup of the ImageCropper is wrong. It's a crop so it will be cropped in that size. Since you have a crop with 0px height that won't work. You'll need to pass a height crop or it won't work. You could disable the keep aspect checkbox so you can change it afterwards.
Jeroen
Hmm, defined a crop of width 200px and height 200px with no aspect ratio.
My image crop in the backend look like this:
but my image on the webpage still is out of scale, it's height is stretched to 200px and not 103px like cropped in the backend.
Is it possible to use DAMP without defining a crop?
greetings,
Anthony
You defined a crop height of 200px. Even if the image height is only 103px it will be streched to 200px because that is the crop you want to have. You can't change this. DAMP can also be used without crops. Maybe the Cultiv Razor Examples has a sample without the Image Cropper and the DAMP Samples package also has a classic sample which uses no Image Cropper.
Jeroen
Oh I see. Then I think it's better to use DAMP without image cropper, because I don't know in advance the scale of the images my end user will upload.
I looked into the DAMP samples package and found this code:
dynamic media = Model.MediaById(Model.dampClassic);
<h3 style="margin-top: 20px;">Razor DAMP classic sample</h3>
<img src="@media.umbracoFile" alt="@media.nodeName" height="400px"/>
So I think I will use this.
Thanks for your advice,
Greetings,
Anthony
You can use that, but it doesn't store the full media xml, but only the id. You can enable this option in the prevalue editor and use it like the PDF example if you want to.
Jeroen
I indeed stored the property by Id:
What is the advantage of storing as Full media xml ?
I'll use DAMP in combination with ImageGen to scale images to a width of 200px
Well the media xml is stored inside the umbraco xml. Otherwise you only have an id and you need to get the media in razor or xslt. See this screenshot for how it looks.
Jeroen
Thanks a lot Jeroen,
I checked out the xml (I should do that more often), stored my property as Full media xml and than read out the information in my Razor script file (EventImage.cshtml) like this:
@inherits umbraco.MacroEngines.DynamicNodeContext
@using DigibizAdvancedMediaPicker;
@{
if (Model.HasValue("eventImage"))
{
dynamic file = Model.eventImage.mediaItem.EventImage;
<img src="@file.umbracoFile" class="eventimage" />
}
}
And this works!
Thanks,
Learned something new today, always a good feeling :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.