0

Apologies if this has come up before. I did check but the previous post referred to version 2.x and was regarding a bug.

I have set up 2 image transforms for images but nothing works. The assets folder is writable. Files upload without issues and I can crop them, rotate them, etc. but Image Transforms don't work.

Anyone know what the issue could be?

  • 1
    Can you post your Twig code where you call upon the image? Do you set your imageTransform handle correctly? docs.craftcms.com/v3/image-transforms.html#app – Tom De Smet Nov 12 '18 at 8:07
  • What's coming back in the HTML where the transform is supposed to be? – Brad Bell Nov 12 '18 at 22:30
  • I am working entirely in the backend at the moment. I haven't developed a front-end. It's my understanding that CraftCMS creates a subfolder within the volume you specify for the original image upload, but when I FTP to that volume there is nothing other than the original image there. – Anthony Nov 13 '18 at 9:06
  • Transforms set up in the CP don't automatically get applied to all of your assets. You need a front-end or some other method requesting the transforms for them to be created. – Mike Pierce Nov 13 '18 at 23:03
0

What Mike Pierce said in the comments above is your answer; Craft doesn't create the image transforms until you ask for them.

So for instance, in a index.twig file you might do something like:

<img src="{{ entry.someAsset.getUrl() }}" />

...which would output the image. If instead you wanted to output the image transformed based on one of the transforms you made in the AdminCP, you'd do:

<img src="{{ entry.someAsset.getUrl("someTransform") }}" />

...where someTransform is the handle to the transform you created in the AdminCP backend. Craft will then perform the image transform, and it'll output the transformed image on the frontend.

The next time that the same transform on the same image is requested, rather than doing the transform all over again, it'll just use the already transformed image that it's saved to disk.

| improve this answer | |

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.