Adding images with a named transform in a Redactor rich text field is causing an Internal Server Error on save:

Object of class Craft\ElementCriteriaModel could not be converted to string

Typical html generated by Redactor reads:

`<img src="http://craft-tryout:8888/assets/images/_thumbnail/afternoon_tea.JPG#asset:41:thumbnail">`

When I manually delete #asset:41:thumbnail this seems to fix the problem.

Images added in normal Craft image fields are all working OK.

  • What is this extra bit of Redactor generated code?

  • Might I have set up something incorrectly with my transforms?

Any suggestions?

  • I can reproduce and confirm this bug. – Christian Steger Aug 17 '14 at 18:52
  • I'm not able to reproduce this locally, unfortunately. Can you reproduce the problem, then submit a ticket from your dashboard's Get Help widget and let it send along your logs and a database backup so we can investigate it. – Brad Bell Aug 18 '14 at 17:20
  • Sorry Brad, before I got your message I deleted and re-imported all the images (I'm working on a small local install to learn my way around Craft and Twig templating). This fixed the problem, but also trampled across all the evidence. If anyone else still has this problem, perhaps they can submit a ticket. – Brian L Aug 20 '14 at 15:19
  • I'm not sure whether this is a bug or not. I wondered whether the error message gave any clues. Also, I've found that the '#asset:41:thumbnail' -type code added by Redactor seems to be normal, as this now appears and works OK in my current set up. I'd still be interested to know what this code does. Hope this is on topic! – Brian L Aug 20 '14 at 17:10