Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Dec 21, 2011 @ 19:35
    Anthony Candaele
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 08:20
    Jeroen Breuer
    1

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 13:33
    Anthony Candaele
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 13:39
    Jeroen Breuer
    0

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 14:38
    Anthony Candaele
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 14:45
    Jeroen Breuer
    1

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 14:53
    Anthony Candaele
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 15:08
    Jeroen Breuer
    0

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 15:16
    Anthony Candaele
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 22, 2011 @ 15:20
    Jeroen Breuer
    1

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 15:45
    Anthony Candaele
    0

    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 :)

     

Please Sign in or register to post replies

Write your reply to:

Draft