<p>Its hard to see without the full context of field setup, but as you state, I believe its <code>{% set image = subsection.previewImage.previewImageFile.one() %}</code> that's the issue.</p>

<p>I can see further down you're correctly looking through <code>subsection.previewImage</code>, which are Super Table blocks. Like so:</p>

<pre><code>{% for block in subsection.previewImage %}
   {% set image = block.previewImageFile.one() %}
</code></pre>

<p>The issue is that you're trying to call <code>previewImageFile</code> on the Super Table block element query, which isn't going to work.</p>

<p>Maybe you're trying to just look at the first block available and get the image from that? If so, you could do:</p>

<pre><code>{% set image = subsection.previewImage[0].previewImageFile.one() %}
</code></pre>

CC BY-SA 4.0
2019-09-10T13:43:53.433Z
2019-09-10T13:43:53.433Z
crawf
<p>I have a Super Table "previewImage" with a field "previewImageFile".</p>

<p>This does not work:  </p>

<pre><code>  &lt;ul class="col-lg-12"&gt;
  {% for subsection in entry.descendants.descendantDist(1).all() %}
    &lt;li class="mb-4"&gt;
      &lt;header&gt;
        &lt;h2 class="mb-2"&gt;{{ subsection.shortTitle }}&lt;/h2&gt;
      &lt;/header&gt;
      {% set image = subsection.previewImage.previewImageFile.one() %}
      {% if subsection.previewImage.previewImageType.value == 'jpg' %}
      {% set transformedImages = craft.imager.transformImage(image,
        [
          { height: 250, jpegQuality: 90 }
        ],
          {
            format: 'jpg',
            allowUpscale: false,
            resizeFilter: 'lanczos',
            effects: { unsharpMask: [0, 0.55, 0.55, 0.008] },
            interlace: false,
            convertToRGB: true
          }
      ) %}

      {% else %}

      {% set transformedImages = craft.imager.transformImage(image,
        [
          { height: 250 }
        ],
          {
            format: 'png',
            allowUpscale: false,
            resizeFilter: 'lanczos',
            effects: { unsharpMask: [0, 0.55, 0.55, 0.008] },
            interlace: false,
            convertToRGB: true
          }
      ) %}
      {% endif %}

      {% for image in subsection.previewImageFile %}
      &lt;a href="{{ subsection.getUrl() }}" title="{{ subsection.linkTitle }}"&gt;
        &lt;picture&gt;
          &lt;source class="img-fluid" srcset="{{ craft.imager.srcset(transformedImages) }}" type="image/jpeg"&gt;
          &lt;img src="{{ transformedImages.url }}"
               srcset="{{ craft.imager.srcset(transformedImages) }}"
               sizes="(min-width: 1366px) 160px, (min-width: 1536px) 160px, 160px"
               width="auto"
               height="250"
               class="img-fluid mr-3"
               alt="{{ block.previewImageAltText }}"&gt;
        &lt;/picture&gt;
        {% endfor %}
      &lt;/a&gt;
    &lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
</code></pre>

<p>I get the a (link) without images.  </p>

<p>I guess <code>previewImageFile.one()</code> is wrong.
But setting it to all throws a error:</p>

<pre><code>get_class() expects parameter 1 to be object, array given
</code></pre>

<assets><plugin-supertable>
Multiple Images/Assets from Super Table?
# Multiple Images/Assets from Super Table?

(Asked by: username_0 on 2019-07-31)

I have a Super Table "previewImage" with a field "previewImageFile".
This does not work:  
  
  {% for subsection in entry.descendants.descendantDist(1).all() %}
    
      
        {{ subsection.shortTitle }}
      
      {% set image = subsection.previewImage.previewImageFile.one() %}
      {% if subsection.previewImage.previewImageType.value == 'jpg' %}
      {% set transformedImages = craft.imager.transformImage(image,
        [
          { height: 250, jpegQuality: 90 }
        ],
          {
            format: 'jpg',
            allowUpscale: false,
            resizeFilter: 'lanczos',
            effects: { unsharpMask: [0, 0.55, 0.55, 0.008] },
            interlace: false,
            convertToRGB: true
          }
      ) %}

      {% else %}

      {% set transformedImages = craft.imager.transformImage(image,
        [
          { height: 250 }
        ],
          {
            format: 'png',
            allowUpscale: false,
            resizeFilter: 'lanczos',
            effects: { unsharpMask: [0, 0.55, 0.55, 0.008] },
            interlace: false,
            convertToRGB: true
          }
      ) %}
      {% endif %}

      {% for image in subsection.previewImageFile %}
      
        
          
          
        
        {% endfor %}
      
    
    {% endfor %}
  

I get the a (link) without images.  
I guess previewImageFile.one() is wrong.
But setting it to all throws a error:
get_class() expects parameter 1 to be object, array given

**Tags:** assets, plugin-supertable

---

## 1 answers

### Answer by username_1 on 2019-09-10. Score: 1

Its hard to see without the full context of field setup, but as you state, I believe its {% set image = subsection.previewImage.previewImageFile.one() %} that's the issue.
I can see further down you're correctly looking through subsection.previewImage, which are Super Table blocks. Like so:
{% for block in subsection.previewImage %}
   {% set image = block.previewImageFile.one() %}

The issue is that you're trying to call previewImageFile on the Super Table block element query, which isn't going to work.
Maybe you're trying to just look at the first block available and get the image from that? If so, you could do:
{% set image = subsection.previewImage[0].previewImageFile.one() %}


---

