3

Is it possible to set a list of asset (images) based on their width? So i just want a list of images that are wider than 1000px for example... Without having to check in a for loop. So on the end of - craft.assets for example.

3

If you want to check all assets across all sources, it'd be this:

{% set assets = craft.assets.width('> ' ~ 1000).find() %}

If you want all assets from a particular source, it'd be:

{% set assets = craft.assets.source('sourceHandle').width('> ' ~ 1004).find() %}
| improve this answer | |
  • Thats great thanks. Slowly unleashing the power or craft! – Spotd Dec 9 '14 at 17:59

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.