Doug Lerner
Doug Lerner

Reputation: 1543

In TinyMCE can the path for an uploaded image be absolute rather than relative?

I created a server-side handler to use with image uploads in TinyMCE. It's not PHP - it's written in my server's server-side JavaScript.

It works fine, but the source that's created inserts relative paths to the imageUploads folder I created, like this:

<img title="Yamada-san 1963.jpg" src="../imageUploads/blobid1616028933077-1616028953409.jpg" alt="" width="145" height="229" />

If the post gets moved, it could break the link to the src.

My image uploader handler at my server returns JSON, as required, with the location using this format:

{ "location" : "http://example.com/imageUploads/' + theFilename + '" }

The location I'm returning looks like an absolute URL, so why is a relative URL used in the editor post? Is there some better JSON I can return?

Thanks.

Upvotes: 3

Views: 1129

Answers (1)

Doug Lerner
Doug Lerner

Reputation: 1543

I found the answer for this in another post.

In the tinymce.init() script this option needs to be added to the other options:

convert_urls: false,

Then the URLs saved are absolute.

Upvotes: 4

Related Questions