Copied to clipboard

Flag this post as spam?

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


  • John Teglmand 8 posts 29 karma points
    May 08, 2012 @ 22:54
    John Teglmand
    1

    How to get image Height and Width

    I have this ... but the Height (@mediaItem.umbracoHeight) and Width (@mediaItem.umbracoWidth) is empty?ยด
    @mediaItem.umbracoFile is OK, I am using umbraco 4.7.2

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @{
      @Html.Raw("<div id=\"s1\" class=\"pics\">")
     
      var parent = @Model.Up();
     
      if (parent != null) {
        foreach (var item in parent.Children.Where("Visible")) {
          dynamic mediaItem = @item.Media("gmp_foto");

          @Html.Raw("<div><img src=\"") 
          @mediaItem.umbracoFile 
          @Html.Raw("\" alt=\"")
          @item.GetProperty("gmp_title").Value
          @Html.Raw("\" Height=\"")
          @mediaItem.umbracoHeight
          @Html.Raw("\" Width=\"")
          @mediaItem.umbracoWidth
          @Html.Raw("\" /><center>")                                                      
          @item.GetProperty("gmp_title").Value
          @Html.Raw("</center><br>")
          if (item.GetProperty("gmp_galleriTekst").Value != "") {
            @item.GetProperty("gmp_galleriTekst").Value
            @Html.Raw("<br>")
          }
          @Html.Raw("</div>")
       }
      }

  • John Teglmand 8 posts 29 karma points
    May 08, 2012 @ 23:18
    John Teglmand
    0

    The wrong medie type (file) was used, and not "Image" in "media"

  • 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