Answers.Body: <p>You are looping through <code>entry.image</code> with the key <code>assets</code> but inside your loop you are trying to access the URL on <code>asset</code>. These need to be the same.</p>
  
  <pre><code>{% for asset in entry.image %}
    &lt;img class="portfolio-images" src="{{ asset.url }}"&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T12:05:17.807Z
Answers.Text: Have have tired various versions/combinations with no luck. What is the correct code please?
Answers.UserDisplayName: DIB
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T12:15:59.677Z
Answers.Text: Have you checked the fieldname is correct? Try adding `{{ entry.image|length }}` to your template and see what the result is.
Answers.UserDisplayName: Luke Pearce
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T12:57:47.050Z
Answers.Text: Hi Luke, Thanks but I tried that and still no luck.  The field name is correct.  I'll try adding   | length  and see how I get on.
Answers.UserDisplayName: DIB
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T13:01:44.247Z
Answers.Text: Do you have devMode on? Luke's answer should've done the trick unless the field name is incorrect or there is no asset.
Answers.UserDisplayName: AbbeyDesign
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T13:07:36.033Z
Answers.Text: When I add  {{ entry.image | length }}  I get 1 displayed on the page.  Sorry I very new to this.
Answers.UserDisplayName: DIB
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T13:18:17.233Z
Answers.Text: That means that there is in fact something there. Can you turn devMode on? That would give you some insight as to if there are any errors.
Answers.UserDisplayName: AbbeyDesign
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T13:26:46.767Z
Answers.Text: Thank you!  I figured it out, it was an error in my asset settings! I am very new to Craft and still trying to figure out what I am doing.
Answers.UserDisplayName: DIB
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T11:14:28.830Z
Answers.LastActivityDate: 2016-08-17T12:14:15.183Z
Answers.LastEditDate: 2016-08-17T12:14:15.183Z
Answers.UserDisplayName: Luke Pearce
Body: <p>I am trying to create a portfolio site. I have set up field for image, description and  a link.</p>
  
  <p>The description and link are being pulled through but the image is not working.  This is what I have for the images field:</p>
  
  <pre><code>{% for assets in entry.image %}
      &lt;img class="portfolio-images" src="{{ asset.url }}"&gt;
  {% endfor %}
  </code></pre>
  
  <p>This is the full entry:</p>
  
  <pre><code>&lt;section class="portfolio-section" id="portfolio"&gt; 
      &lt;h2 id="opaque" style="color:white;"&gt;Here are a few of the projects I have been working on recently.&lt;/h2&gt;
      &lt;ul class="portfolio Grid"&gt;
  
          {% for entry in craft.entries.section('portfolio').limit(9) %}
              &lt;li class="portfolio-item Grid-item Grid-third"&gt;
                  &lt;div class="portfolio-info"&gt;
                      &lt;h3 class="portfolio-title"&gt;{{entry.title}}&lt;/h3&gt;
  
                      {% for assets in entry.image %}
                          &lt;img class="portfolio-images" src="{{ asset.url }}"&gt;
                      {% endfor %}
  
                      {{entry.description}}
                  &lt;/div&gt;
  
                  &lt;a href="{{entry.website_link}}" target="_blank"&gt;&lt;button class="button" type="button"&gt;View website&lt;/button&gt; &lt;/a&gt;
              &lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>Why is the text and link working but the image not?</p>
  
  <p>Thanks!</p>
  
Tags: <assets>
Title: Assets in Template
ThreadText: # Assets in Template
  
  (Asked by: username_0 on 2016-08-17)
  
  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!
  
  **Tags:** assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-17. Score: 5
  
  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 %}
  
  ```
  
  > **Comments:**
  > **username_0**: Have have tired various versions/combinations with no luck. What is the correct code please?  
  > **username_1**: Have you checked the fieldname is correct? Try adding `{{ entry.image|length }}` to your template and see what the result is.  
  > **username_0**: Hi username_1, Thanks but I tried that and still no luck.  The field name is correct.  I'll try adding   | length  and see how I get on.  
  > **username_2**: Do you have devMode on? username_1's answer should've done the trick unless the field name is incorrect or there is no asset.  
  > **username_0**: When I add  {{ entry.image | length }}  I get 1 displayed on the page.  Sorry I very new to this.  
  > **username_2**: That means that there is in fact something there. Can you turn devMode on? That would give you some insight as to if there are any errors.  
  > **username_0**: Thank you!  I figured it out, it was an error in my asset settings! I am very new to Craft and still trying to figure out what I am doing.  
  
  ---
  
  