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
    Jan 10, 2014 @ 16:49
    Anthony Candaele
    0

    issue with DAMP Property Editor Value Converter

    Hi,

    Is there an issue with DAMP Property Editor Value Converter (version 1.2) and Umbraco 6.1.6 ?

    When I try to run this code, I get a KeyNotFoundException:

    @foreach (var sponsor in sponsors)
        {
            if (sponsor.HasValue("sponsorImage"))
                    {
                      var image =  sponsor.GetPropertyValue<DAMP.PropertyEditorValueConverter.Model>("sponsorImage");
    
                      <li class="block">
                          <img alt="@image.First.Alt" src="@image.First.TypedCrops["sponsorcrop"]" />
    
                      </li>
                    }           
    
        }
    

    This code worked fine in previous Umbraco installs.

    greetings,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Jan 13, 2014 @ 10:56
    Anthony Candaele
    0

    Anyone an idea why this code isn't working?

    I access the sponsor nodes like this:

    var sponsors = Model.Content.DescendantsOrSelf().Where(x => x.DocumentTypeAlias == "Sponsor");
    

    It's returning 4 IPublishedContent objects, holding the sponsor data.

    When debugging, I get a KeynotFoundException on this line:

    var image =  sponsor.GetPropertyValue<DAMP.PropertyEditorValueConverter.Model>("sponsorImage");
    

    thanks for your help,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Jan 13, 2014 @ 11:23
    Anthony Candaele
    0

    Found the issue, it was caused because there wasn't defined a crop (sponsorCrop) in the Sponsor Image Cropper property (of type Image Cropper). I guess this happened because I didn't define a width when creating the Sponsor Image Cropper propery.

    Which brings me to my next question, how can I define an Image Cropper property for images with variable heights.

    Thanks for your help,

    Anthony

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Jan 13, 2014 @ 11:23
    Jeroen Breuer
    1

    Hello,

    Can you give the stacktrace of the KeynotFoundException exception? Something probably goes wrong with creating the DAMP model, but I don't really know what it is.

    Jeroen

  • Anthony Candaele 1197 posts 2049 karma points
    Jan 13, 2014 @ 11:29
    Anthony Candaele
    0

    Hi Jeroen, our posts crossed. The issue is solved, there wheren't any crops created because the crop definition in the Image Cropper was empty.

    The only problem I need to solve now are the dimensions of the sponsor logo's:

    enter image description here

    Is their a way to retain aspect ratio for images of variable heights ?

  • 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.

Please Sign in or register to post replies