My frontend template displays the assets that have been uploaded to Craft. I could create a series of asset transforms within that template to create a range of thumbnail sizes.

Not too sure about the way this works but am I correct in thinking that every transform generates a new asset, to be more efficient with storage could I not reuse the transformed assets that the Control Panel creates?

I inspect the Assets panel in the backend and it has a url http://localhost:8888/index.php?p=admin/actions/assets/generate-thumb&uid=219035f4-92ae-41d6-ad95-0f6a4c38faa9&width=30&height=30&v=1521142167 I could pass the UID of the image to that url or may be instead match the sizes the CP creates would this reuse the same images instead of adding to my S3 storage?

1 Answer 1


There's actually a really easy way to achieve this (Craft 3 only).

Simply do this in your code:

<img src="{{ image.thumbUrl(int) }}">

{# int is a number that represents the width/height #}

The asset thumbnails are stored in /storage/runtime/assets/thumbs/, so no, they won't be taking up space in your S3 bucket (whereas some local testing inclines me to think that images generated via transforms are stored in your Asset Volume, wherever it's located).

  • would you mind to explain why this should only work for Craft 3? Mar 19, 2018 at 19:36
  • @RobinSchambach yeah definitely - it seems from digging around in the Craft source code that thumbUrl got a bit of an upgrade in Craft 3. In Craft 2, it seems from some local testing that thumbUrl just tries to use thumbnail images from /storage/runtime/assets/thumbs/ if they already exist - which means that if someone were to clear the /storage directory (which could happen on deployment for example), Craft 2 will all of a sudden start showing broken image icons. In Craft 3, it seems that thumbUrl actually generates the thumbnails for you if they don't exist. Mar 20, 2018 at 14:52
  • I'm not 100% certain that it doesn't work on Craft 2 (could always be some weirdness or mis-config on my end), so for now I'll leave that as a comment (vs. updating my answer), unless someone else can verify that the behavior I described is indeed the norm. Mar 20, 2018 at 14:54
  • Amazing thanks. yeah I'm using Craft 3
    – Jai Sandhu
    Mar 20, 2018 at 19:23

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.