Answers.Body: <p>This is a misunderstanding of the difference between an ElementCriteria model and actual fetched elements.</p>
  
  <p>Some useful background reading: </p>
  
  <p><a href="https://craftcms.com/docs/templating/elementcriteriamodel" rel="nofollow">https://craftcms.com/docs/templating/elementcriteriamodel</a></p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements">What are the differences between an elementCriteriaModel and fetched elements?</a></p>
  
  <p>You could do what you're looking for using Twig's <a href="http://twig.sensiolabs.org/doc/functions/random.html" rel="nofollow">random</a> method:</p>
  
  <pre><code>{% set projectImg = craft.entries.section('projekte').find() %}
  {% set projectImages = [] %}
  
  {% for item in projectImg %}
      {% set currentImage = item.bild %}
      {% set projectImages = projectImages | merge(currentImage) %}
  {% endfor %}
  
  {# Grab 3 random images from the array #}
  {% for counter in 0..2 %}
      {% set asset = random(projectImages) %}
  
      &lt;img src="{{ asset.url }}"&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-17T17:37:36.503Z
Answers.LastActivityDate: 2016-10-17T17:37:36.503Z
Answers.UserDisplayName: Brad Bell
Body: <p>I want to get all images from the section <code>projekte</code> which are bound to the asset field <code>bild</code> I then want to fiddle around with <code>.limit()</code> and maybe <code>random</code> filters.</p>
  
  <p>So I grabbed all images like described <a href="https://craftcms.stackexchange.com/questions/12152/how-to-grab-all-images-from-and-section">here</a></p>
  
  <p>This works but as soon as I add <code>.limit()</code></p>
  
  <pre><code>{% set projectImg = craft.entries.section('projekte').find() %}
  {% set projectImages = [] %}
  
  {% for item in projectImg %}
    {% set currentImage = item.bild %}
    {% set projectImages = projectImages | merge(currentImage) %}
  {% endfor %}
  
  {% for asset in projectImages.limit(3) %}
     &lt;img src="{{ asset.url }}"&gt;
  {% endfor %}
  </code></pre>
  
  <p>This results in </p>
  
  <blockquote>
    <p>PHP Notice: Array to string conversion</p>
  </blockquote>
  
  <p>Why can't I just ad whatever filter I want on that new loop now?</p>
  
Tags: <assets><filter><loop><assetfilemodel>
Title: Get all images from a section
ThreadText: # Get all images from a section
  
  (Asked by: username_0 on 2016-10-17)
  
  I want to get all images from the section `projekte` which are bound to the asset field `bild` I then want to fiddle around with `.limit()` and maybe `random` filters.
  
  So I grabbed all images like described [here](https://craftcms.stackexchange.com/questions/12152/how-to-grab-all-images-from-and-section)
  
  This works but as soon as I add `.limit()`
  
  ```
  {% set projectImg = craft.entries.section('projekte').find() %}
  {% set projectImages = [] %}
  
  {% for item in projectImg %}
    {% set currentImage = item.bild %}
    {% set projectImages = projectImages | merge(currentImage) %}
  {% endfor %}
  
  {% for asset in projectImages.limit(3) %}
     <img src="{{ asset.url }}">
  {% endfor %}
  
  ```
  
  This results in
  
  > PHP Notice: Array to string conversion
  
  Why can't I just ad whatever filter I want on that new loop now?
  
  **Tags:** assets, filter, loop, assetfilemodel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-17. Score: 0 | Accepted answer
  
  This is a misunderstanding of the difference between an ElementCriteria model and actual fetched elements.
  
  Some useful background reading:
  
  <https://craftcms.com/docs/templating/elementcriteriamodel>
  
  [What are the differences between an elementCriteriaModel and fetched elements?](https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements)
  
  You could do what you're looking for using Twig's [random](http://twig.sensiolabs.org/doc/functions/random.html) method:
  
  ```
  {% set projectImg = craft.entries.section('projekte').find() %}
  {% set projectImages = [] %}
  
  {% for item in projectImg %}
      {% set currentImage = item.bild %}
      {% set projectImages = projectImages | merge(currentImage) %}
  {% endfor %}
  
  {# Grab 3 random images from the array #}
  {% for counter in 0..2 %}
      {% set asset = random(projectImages) %}
  
      <img src="{{ asset.url }}">
  {% endfor %}
  
  ```
  
  
  ---
  
  