Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get Craft to render an image transform defined in the control panel. No image is added to the "filelocation/_transformhandle" folder and returns the url "/cpresources/transforms/98" where 98 is the transform index.

I have tried clearing the cache and db table already as well as updating the asset index. I have double checked the sources paths and it is not a file permission issue.

Code example as a matrix block:

{% elseif block.type == "slideShow" %} 
{% if block.galleryImages|length>0 %}

{% for image in block.galleryImages %}
    {{ image.aboutText }}
    <img src="{{ image.getUrl('galleryHorizontal') }}">
{% endfor %}
{% endif %}

I tried using the other methods on this page in the docs with the same result.


share|improve this question
up vote 12 down vote accepted

That’s what getUrl() returns if the transform hasn’t been generated yet. When the browser requests that URL, Craft will generate the transform, and respond with a 302 redirect to the actual image URL.

Update: As of Craft 2.2, even if the transform generation URL doesn’t get directly requested (e.g. if it’s a social media image, or a srcset size that doesn’t apply to the browser), it will still get generated automatically as a background task as soon as Craft is done serving the page.

The next time getUrl() gets called (after the transform has been generated), the image URL will be returned directly.

If you would prefer that getUrl() actually generates the transform itself and immediately returns the image URL (perhaps because the output is getting cached by Varnish or something), you can open up craft/config/general.php and add this to your config array:

'generateTransformsBeforePageLoad' => true,

(See for details.)

share|improve this answer
I'm not caching the output. When the code is loaded by the browser the transformed jpg isn't loaded. The console says: Failed to load resource: the server responded with a status of 404 (Not Found). – FrankFlitton Jul 8 '14 at 17:10
Thanks for the hot tip with the 302 redirect! It was a sources issue. I changed it to File System Path: ./assets/images/Gallery/ and URL: /assets/images/Gallery/ in the CP and it works fine now. – FrankFlitton Jul 8 '14 at 17:50
Glad you got it sorted :) – Brandon Kelly Jul 8 '14 at 19:22

I've also seen this triggered by directory/file permission issues, namely that Craft didn't have write access to the image asset directory. Once I fixed the permissions with chmod, my specific problem was solved.

chmod 777 -R images
share|improve this answer

I also had this problem and changing the setting worked for me.

I did have a problem where the transforms then showed a 404 page rather than the actual image. Clearing the 'Cache' via settings in Craft CMS fixed this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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