I have an issue that I really do not expect. When using the image function in the Redactor wysiwyg editor, images come up broken. In the editor, and in the rendered entry. All that is missing is a / in the img tag and they work. So redactor is rendering,

<img src="assets/page/AdobeStock_53786360.jpeg" alt="AdobeStock_53786360.jpeg#asset:99">

and but what it needs is the beginning /

<img src="/assets/page/AdobeStock_53786360.jpeg" alt="AdobeStock_53786360.jpeg#asset:99">

Have I configured something else wrong?

  • 1
    What's in your Asset source's URL setting? – Mats Mikkel Rummelhoff Aug 5 '16 at 9:06
  • Yep that was it. I guess I was adding a / in my templates when grabbing an image. Did not realize that it would break redactor. Thanks! – David B Aug 8 '16 at 2:37

I was adding a slash in from after grabbing image urls in my template code,

/{{ image }}

Did not think about how it might break redactor.

| improve this answer | |

I ran into a similar issue. The paths that were being inserted for images in the Redactor field were relative, like assets/folder/file.jpg so in the context of the Craft admin, they were trying to load a path like admin/entries/blog/assets/folder/file.jpg which obviously wouldn't work.

I was able to fix this by updating the "assetsBaseUrl value in my craft/config/general.php to include a leading slash, like:

'assetsBaseUrl' => '/assets'

That forced the admin to reach out to the absolute root location of the assets folder rather than trying to load based on a relative path from somewhere deep inside the admin.

| 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.