2

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<br />
  Do This<br /><br />
else<br />
  Do that<br />
2

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 %}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.