Copied to clipboard

Flag this post as spam?

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


  • Tove 15 posts 35 karma points
    May 26, 2015 @ 18:06
    Tove
    0

    How to render images with LeBlender?

    Hi How is the best way to render images using LeBlender?

    The code here (on Pastie)

    gives me the following error within the grid:

    "Something went wrong with this editor, below is the exception detail:

    The value of parameter 'id' must be either a string or an integer"

    Thanka in advance /T

  • Amir Khan 1287 posts 2744 karma points
    May 26, 2015 @ 18:38
    Amir Khan
    0

    Hi Tove, what datatype contains the images you're trying to render?

    -Amir

  • Tove 15 posts 35 karma points
    May 26, 2015 @ 19:12
    Tove
    0

    Hi Amir Its the image picker

    Best /Tove

  • Amir Khan 1287 posts 2744 karma points
    May 26, 2015 @ 20:01
    Amir Khan
    0

    Here's an example that will render a list of images for you if you're datatype is the new media picker.

    @inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>

    @if (Model.Items.Any())
    {
    <!-- Wrapper for slides -->
    <ul>
    @{
    var item = Model.Items.ElementAt(0);

    var imageList = item.GetValue<string>("multiImageSlider");
    if (!string.IsNullOrWhiteSpace(imageList))
    {
    var imgList = imageList.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);

    var imgListCollection = Umbraco.TypedMedia(imgList);

    if (imgListCollection != null)
    {
    foreach (var img in imgListCollection)
    {
    <li><img src="@img.Url"></li>
    }
    }
    }
    }
    </ul>
    }
Please Sign in or register to post replies

Write your reply to:

Draft