Copied to clipboard

Flag this post as spam?

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


  • jaco steketee 30 posts 187 karma points
    Feb 25, 2018 @ 15:48
    jaco steketee
    0

    umbraco 7.7.6 How do i get my images

    Hi, i hope sombody can help me...this is driving me nuts. Ive been searching for days and trying lots of different code but my images aren't showing in my for each loop... im doing something wrong but the way i normally do it somehow doesnt work anymore. im simply trting to get images from the imagepicker

    This is my code HEADER:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "MasterTemplate.cshtml";
        var ListofProducts = CurrentPage.Children();
    
    }
    

    code

    @foreach(var item in ListofProducts)
    {
        <article class="portfolio-item pf-media pf-icons">
            <div class="portfolio-image">
                    <a href="@item.url">
                    <img alt="test" src="@item.GetPropertyValue<IPublishedContent>("Foto").url"
    
                    </a>
                <div class="portfolio-overlay">
                    <a href="images/portfolio/full/1.jpg" class="left-icon" data-lightbox="image"><i class="icon-line-plus"></i></a>
                    <a href="portfolio-single.html" class="right-icon"><i class="icon-line-ellipsis"></i></a>
                </div>
            </div>
                <div class="portfolio-desc">
                    <h3><a href="portfolio-single.html">Open Imagination</a></h3>
                    <span><a href="#">Media</a>, <a href="#">Icons</a></span>
                </div>
        </article>
    
    }
    
  • Nigel Wilson 945 posts 2077 karma points
    Feb 25, 2018 @ 18:08
    Nigel Wilson
    100

    Might be totally off track, but should

    <img alt="test" src="@item.GetPropertyValue<IPublishedContent>("Foto").url"
    

    be

    <img alt="test" src="@item.GetPropertyValue<IPublishedContent>("Foto").Url" />
    

    So capital U in Url and also the closing bracket on the image tag.

    Cheers

    Nigel

  • jaco steketee 30 posts 187 karma points
    Feb 26, 2018 @ 07:55
    jaco steketee
    0

    Thank you very much Nigel. It did the trick when i used the capital U and got rid of the

  • Nigel Wilson 945 posts 2077 karma points
    Feb 26, 2018 @ 16:07
    Nigel Wilson
    0

    All good Jaco - maybe mark your post as solved so others know it's sorted.

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft