<p>I was adding a slash in from after grabbing image urls in my template code,</p>

<pre><code>/{{ image }}
</code></pre>

<p>Did not think about how it might break redactor.</p>

CC BY-SA 3.0
2016-08-08T02:38:51.877Z
2016-08-08T02:38:51.877Z
David B
<p>I ran into a similar issue. The paths that were being inserted for images in the Redactor field were relative, like <em>assets/folder/file.jpg</em> so in the context of the Craft admin, they were trying to load a path like <em>admin/entries/blog/assets/folder/file.jpg</em> which obviously wouldn't work.</p>

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

<pre><code>'assetsBaseUrl' =&gt; '/assets'
</code></pre>

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

CC BY-SA 4.0
2017-09-11T21:52:57.060Z
2019-03-03T05:10:58.033Z
2019-03-03T05:10:58.033Z
Will Henderson
<p>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,</p>

<pre><code>&lt;img src="assets/page/AdobeStock_53786360.jpeg" alt="AdobeStock_53786360.jpeg#asset:99"&gt;
</code></pre>

<p>and but what it needs is the beginning /</p>

<pre><code>&lt;img src="/assets/page/AdobeStock_53786360.jpeg" alt="AdobeStock_53786360.jpeg#asset:99"&gt;
</code></pre>

<p>Have I configured something else wrong?</p>

CC BY-SA 3.0
2016-08-05T09:06:25.657Z
What's in your Asset source's URL setting?
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2016-08-08T02:37:46.153Z
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
<redactor><image>
Images Broken In Redactor
# Images Broken In Redactor

(Asked by: username_0 on 2016-08-04)

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,


and but what it needs is the beginning /


Have I configured something else wrong?

**Tags:** redactor, image
> **Comments:**
> **username_1**: What's in your Asset source's URL setting?  
> **username_0**: 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!  

---

## 2 answers

### Answer by username_0 on 2016-08-08. Score: 1

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.


---

### Answer by username_2 on 2017-09-11. Score: 1

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.


---

