Answers.Body: <p>Your image input returns and array so you need to reference the first item, even if you only allowed one to be selected.</p>
  
  <pre><code>{% set news = craft.entries.section('news').limit(3) %}
  {% for news in news %}
     {% set cover = news.promotionNewsImage %}
     {% if cover|length %}
         {{ cover[0].getUrl('gtLg') }}
     {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-30T20:01:57.263Z
Answers.Text: That has solved my problem, only when I run it outside `<style type="text/css">@media (min-width: 1200px){.news{code}}</style>`. I thought, that neccesary markup will not affect the output. I may post my code here, but I feel like it's another question. What do you say?
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-30T21:03:45.707Z
Answers.Text: You may need to post that separately that seems different to what you asked above.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-30T19:34:23.563Z
Answers.LastActivityDate: 2015-10-30T19:34:23.563Z
Answers.UserDisplayName: a-am
Body: <p>I've run into an unexpected situation, where ElementCriteriaModel could not be converted to string.</p>
  
  <pre><code>{% set news = craft.entries.section('news').limit(3) %}
  {% for news in news %}
      {% set cover = news.promotionNewsImage %}
      {% if cover|length %}
          {{ cover.getUrl('gtLg') }}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Any thoughts on that please?</p>
  
Tags: <assets>
Title: How do I output image in the loop for an entry?
ThreadText: # How do I output image in the loop for an entry?
  
  (Asked by: username_0 on 2015-10-30)
  
  I've run into an unexpected situation, where ElementCriteriaModel could not be converted to string.
  
  ```
  {% set news = craft.entries.section('news').limit(3) %}
  {% for news in news %}
      {% set cover = news.promotionNewsImage %}
      {% if cover|length %}
          {{ cover.getUrl('gtLg') }}
      {% endif %}
  {% endfor %}
  
  ```
  
  Any thoughts on that please?
  
  **Tags:** assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-30. Score: 5 | Accepted answer
  
  Your image input returns and array so you need to reference the first item, even if you only allowed one to be selected.
  
  ```
  {% set news = craft.entries.section('news').limit(3) %}
  {% for news in news %}
     {% set cover = news.promotionNewsImage %}
     {% if cover|length %}
         {{ cover[0].getUrl('gtLg') }}
     {% endif %}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: That has solved my problem, only when I run it outside `<style type="text/css">@media (min-width: 1200px){.news{code}}</style>`. I thought, that neccesary markup will not affect the output. I may post my code here, but I feel like it's another question. What do you say?  
  > **username_1**: You may need to post that separately that seems different to what you asked above.  
  
  ---
  
  