title: TYPO3 DCE: image in section
body: <p>How can I use a image field in a DCE section? </p>
  
  <p>An image <strong>element</strong> (myImage) can be accessed like this: </p>
  
  <pre><code>&lt;f:for each="{dce:fal(field:'myImage', contentObject:contentObject)}" as="fileReference"&gt;
     &lt;f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" /&gt;
  &lt;/f:for&gt;
  </code></pre>
  
  <p>But if I loop through a <strong>section</strong> (mySection), this code does not work. </p>
  
  <p><strong>Solution after lots of debug:</strong> </p>
  
  <ol>
  <li><p>Use this element for "myImage": File Abstraction Layer (section use only)</p>
  
  <pre><code>&lt;config&gt;
   &lt;type&gt;group&lt;/type&gt;
   &lt;internal_type&gt;db&lt;/internal_type&gt;
   &lt;appearance&gt;
      &lt;elementBrowserType&gt;file&lt;/elementBrowserType&gt;
      &lt;elementBrowserAllowed&gt;jpg,jpeg,png,gif&lt;/elementBrowserAllowed&gt;
   &lt;/appearance&gt;
   &lt;allowed&gt;sys_file&lt;/allowed&gt;
   &lt;size&gt;1&lt;/size&gt;
   &lt;minitems&gt;1&lt;/minitems&gt;
   &lt;maxitems&gt;1&lt;/maxitems&gt;
   &lt;show_thumbs&gt;1&lt;/show_thumbs&gt;
  &lt;/config&gt;
  </code></pre></li>
  <li><p>Use this template code</p>
  
  <pre><code> &lt;f:for each="{field.mySection}" as="teaserbox"&gt;
     &lt;f:image src="{teaserbox.image}" alt="" /&gt;
     {teaserbox.text}
   &lt;/f:for&gt;
  </code></pre></li>
  </ol>
  
  <p>You have to remove <code>treatIdAsReference="1"</code> - it will cause this error: </p>
  
  <pre><code>    No file usage (sys_file_reference) found for given UID.
  </code></pre>
  
  <p>This is not the 100% perfect solution, as you don't have the fields like <code>alt</code>, but it works. Better solutions are welcome!</p>