2

When using image transforms, Craft not only doesn't seem to be outputting the transformed image, but the image path it's then giving back to the template is: <img src="http://example.com/cpresources/transforms/1" /> which doesn't exist.

I have a upload path defined, which is http://example.com/assets/uploads/ but obviously it isn't respecting that.

I can't find any docs on where to define the transformations image path so wondered if anyone could shed some light?

4

Craft doesn't have a setting for defining the transformations image path, they are automatically placed in a subfolder inside your created assets source' path. It could look something like this _960x540_crop_center-center_70, if you had a transform like this:

{ width: 960, height: 540, mode: 'crop', position: 'center-center', quality: 70 }

By default, the url you're seeing is what Craft will return if the transform hasn’t been generated yet. The next time the page is loaded, it should reference the actual image file. See Brandon's answer here, for a more thorough explanation.

But, if everything is working, you should see the image in your browser even if it returns the transform url. If the image isn't created, check if the file path for your asset source is correct (guess it is if you can upload images), and that url rewriting is working.

| improve this answer | |
  • Upload path is correct and is writeable as i have been uploading images to that folder quite happily. Subsequent refreshes don't show the image either. Quite the puzzler! – John Oct 20 '14 at 12:39
  • Aha! The post you reference says to add 'generateTransformsBeforePageLoad' => true to the config and that is what did the trick. Thanks Andre! – John Oct 20 '14 at 12:42
  • Ok, that setting should just ensure that the image is created before the first page load, so you'll never see that transform url. I prefer this too, but it should work without it unless there's something else that's wrong. – André Elvan Oct 20 '14 at 13:19

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.