<p>Something like this should work:</p>

<pre><code>{% set totalWidth = 0 %}

{% for asset in myAssetList %}
    {% set totalWidth = totalWidth + asset.width %}
{% endfor %}

{% if totalWidth &gt; 750 %}
    Do this.
{% else %}
    Do that.
{% endif %}
</code></pre>

CC BY-SA 3.0
2014-11-21T19:35:56.593Z
2014-11-21T19:35:56.593Z
Brad Bell
<p>How can I check if multiple asset image widths combined are wider than X?
So how do i get X?</p>

<p>Like this:</p>

<p>File 1 = 300px wide<br />
File 2 = 200px wide<br />
File 3 = 250px wide<br /></p>

<pre><code>x &gt;= 750px than&lt;br /&gt;
  Do This&lt;br /&gt;&lt;br /&gt;
else&lt;br /&gt;
  Do that&lt;br /&gt;
</code></pre>

<assets><image-transforms><image>
Combine image assets widths to get total width
# Combine image assets widths to get total width

(Asked by: username_0 on 2014-11-21)

How can I check if multiple asset image widths combined are wider than X?
So how do i get X?
Like this:
File 1 = 300px wide
File 2 = 200px wide
File 3 = 250px wide
x >= 750px than
  Do This
else
  Do that

**Tags:** assets, image-transforms, image

---

## 1 answers

### Answer by username_1 on 2014-11-21. Score: 2 | Accepted answer

Something like this should work:
{% set totalWidth = 0 %}

{% for asset in myAssetList %}
    {% set totalWidth = totalWidth + asset.width %}
{% endfor %}

{% if totalWidth > 750 %}
    Do this.
{% else %}
    Do that.
{% endif %}


---

