Copied to clipboard

Flag this post as spam?

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


  • Shin Jin 7 posts 87 karma points
    Nov 28, 2015 @ 07:34
    Shin Jin
    0

    truncate picture help !!

    help iszit possible to truncate picture ? eg. i want to only display 2 picture on blogoverview using multi media pick.. here is my code....

    foreach(var post in items.Skip((page - 1) * pageSize).Take(pageSize).OrderBy(x=>x.Name)){
        <article>
            <div class="post-image">
                <div class="post-heading">
                    <h2>@post.Name</h2>
                </div>
            </div>
            <p>
    

    @{ if (post.HasValue("imgContent")) { var imagesList = post.GetPropertyValue

    foreach (var imageItem in imagesCollection)
        {      
            <img src="@Umbraco.Truncate(@imageItem.Url, 50, true)"/>  
    
        }                                                               
    

    }}

    }

  • gary 385 posts 915 karma points
    Nov 28, 2015 @ 10:35
    gary
    100

    Hi Shin Jin

    You could try

    foreach (var imageItem in imagesCollection.Take(2))
    {      
        <img src="@Umbraco(@imageItem.Url)"/>  
    
    } 
    

    Regards

    Gary

  • Shin Jin 7 posts 87 karma points
    Nov 28, 2015 @ 20:15
    Shin Jin
    0

    Thank gary !! it works !!

  • 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