Q:

Assets in Template

I am trying to create a portfolio site. I have set up field for image, description and  a link.
The description and link are being pulled through but the image is not working.  This is what I have for the images field:
{% for assets in entry.image %}
    <img class="portfolio-images" src="{{ asset.url }}">
{% endfor %}

This is the full entry:
<section class="portfolio-section" id="portfolio"> 
    <h2 id="opaque" style="color:white;">Here are a few of the projects I have been working on recently.</h2>
    <ul class="portfolio Grid">

        {% for entry in craft.entries.section('portfolio').limit(9) %}
            <li class="portfolio-item Grid-item Grid-third">
                <div class="portfolio-info">
                    <h3 class="portfolio-title">{{entry.title}}</h3>

                    {% for assets in entry.image %}
                        <img class="portfolio-images" src="{{ asset.url }}">
                    {% endfor %}

                    {{entry.description}}
                </div>

                <a href="{{entry.website_link}}" target="_blank"><button class="button" type="button">View website</button> </a>
            </li>
        {% endfor %}
    </ul>
</section>

Why is the text and link working but the image not?
Thanks!

A:

You are looping through entry.image with the key assets but inside your loop you are trying to access the URL on asset. These need to be the same.
{% for asset in entry.image %}
  <img class="portfolio-images" src="{{ asset.url }}">
{% endfor %}

