New answers tagged

2

The Volumes service is available via craft.app.volumes, so you can do {% set volume = craft.app.volumes.getVolumeByHandle('volumeHandle') %} {{ volume.name }} or {% set volume = craft.app.volumes.getVolumeById(123) %} {{ volume.name }} Additionally, if you have an Asset model available, you can get its volume like this: {% set volume = asset.volume %} {{ ...


1

Figured it out: {% set query = craft.assets.volume('volumeHandle').one() %} {{ query.volume.name }}


2

Interesting problem! I took a stab at this, see if this works for your use case. It relies on ImageMagick to check for the top left pixel color (0,0) after the image is uploaded (but will also work if you hit resave). (If you want to check the other 3 corners, you'll need more code but this should get you started.) To use it, you'll need a lightswitch field ...


Top 50 recent answers are included