Answers.Body: <p>When using the for loop you don't need to set <code>image</code> as it is set in the for loop. You will also need to define <code>transformedImage</code> on every iteration, so move it within the for loop.</p>
  
  <p>Give the below a go, it should do what you are after.</p>
  
  <pre><code>&lt;div id="header-slider"&gt;
    &lt;ul&gt;
      {% for image in entry.bannerSlider %}
        {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}
        &lt;li data-transition="" data-masterspeed="500"&gt;
          &lt;img src="{{ transformedImage.url }}"/&gt;
        &lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T04:42:27.717Z
Answers.Text: What if you wanted to pull the image out of another section? Like `{% for image in craft.entries.section('news').limit(1) %}
            {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint }) %}
           <img src="{{ image.bannerImage.first().getUrl }}" alt="" />
           {% endfor %}` Where do you then define the image? (bannerImage = asset field)
Answers.UserDisplayName: Nutmeg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T06:44:05.143Z
Answers.Text: **This would be better as a new question**. But if you wanted to pull images from different sections you would be better off building up an array in twig then looping through that array to display the images
Answers.UserDisplayName: Fyrebase
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T06:56:12.460Z
Answers.Text: yes, I agree - would you mind following this up in this new [thread](http://craftcms.stackexchange.com/questions/18434/pulling-images-from-other-sections-with-image-transform)?
Answers.UserDisplayName: Nutmeg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T04:03:00.543Z
Answers.LastActivityDate: 2017-01-09T04:26:07.250Z
Answers.LastEditDate: 2017-01-09T04:26:07.250Z
Answers.UserDisplayName: Fyrebase
Body: <p>I'm stuck with the <code>.first()</code> element and why the for-loop code won't work. </p>
  
  <pre><code>&lt;div id="header-slider"&gt;
    &lt;ul&gt;        
      {% set image = entry.bannerSlider.first() %}
      {% set transformedImage = craft.imager.transformImage(image, 
        { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}
      {% for image in entry.bannerSlider %}
        &lt;li data-transition="" data-masterspeed="500"&gt;
          &lt;img src="{{ transformedImage.url }}"/&gt;
        &lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>If I remove the <code>.first()</code> element the code breaks ("An unknown image object was used"), but, as this code populates a slider, I need all the images loaded, hence my attempt with the for-loop.</p>
  
  <p>I think I am mixing up different Models, but need someone to point it out, please...</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-09T03:46:33.280Z
Comments.Text: Going on that error, you are mixing the models up indeed. What is `bannerSlider`, Is it a asset field, matrix or something else?
Comments.UserDisplayName: Fyrebase
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-09T03:57:44.427Z
Comments.Text: The `bannerSlider` is an asset field.
Comments.UserDisplayName: Nutmeg
Tags: <forloop><plugin-imager>
Title: Image(r) transform and for loop
ThreadText: # Image(r) transform and for loop
  
  (Asked by: username_0 on 2017-01-09)
  
  I'm stuck with the `.first()` element and why the for-loop code won't work.
  
  ```
  <div id="header-slider">
    <ul>        
      {% set image = entry.bannerSlider.first() %}
      {% set transformedImage = craft.imager.transformImage(image, 
        { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}
      {% for image in entry.bannerSlider %}
        <li data-transition="" data-masterspeed="500">
          <img src="{{ transformedImage.url }}"/>
        </li>
      {% endfor %}
    </ul>
  </div>
  
  ```
  
  If I remove the `.first()` element the code breaks ("An unknown image object was used"), but, as this code populates a slider, I need all the images loaded, hence my attempt with the for-loop.
  
  I think I am mixing up different Models, but need someone to point it out, please...
  
  **Tags:** forloop, plugin-imager
  
  > **Comments:**
  > **username_1**: Going on that error, you are mixing the models up indeed. What is `bannerSlider`, Is it a asset field, matrix or something else?  
  > **username_0**: The `bannerSlider` is an asset field.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-09. Score: 4 | Accepted answer
  
  When using the for loop you don't need to set `image` as it is set in the for loop. You will also need to define `transformedImage` on every iteration, so move it within the for loop.
  
  Give the below a go, it should do what you are after.
  
  ```
  <div id="header-slider">
    <ul>
      {% for image in entry.bannerSlider %}
        {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}
        <li data-transition="" data-masterspeed="500">
          <img src="{{ transformedImage.url }}"/>
        </li>
      {% endfor %}
    </ul>
  </div>
  
  ```
  
  > **Comments:**
  > **username_0**: What if you wanted to pull the image out of another section? Like `{% for image in craft.entries.section('news').limit(1) %}           {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint }) %}          <img src="{{ image.bannerImage.first().getUrl }}" alt="" />          {% endfor %}` Where do you then define the image? (bannerImage = asset field)  
  > **username_1**: **This would be better as a new question**. But if you wanted to pull images from different sections you would be better off building up an array in twig then looping through that array to display the images  
  > **username_0**: yes, I agree - would you mind following this up in this new [thread](http://craftcms.stackexchange.com/questions/18434/pulling-images-from-other-sections-with-image-transform)?  
  
  ---
  
  