user9741470
user9741470

Reputation:

TinyMCE display correct image path from frontend

How i can display the correct url for the image uploaded using TinyMCE? I get a file not found error, this because when I load the created contents on the frontend, the src attribute of the images contained inside the post are referring to my img path like this ../../img/prt/image.jpg, and it's the correct path for the backend, but from the index i need that the src is set to img/prt/image.jpg that is the correct path. Any suggestion?

Upvotes: 1

Views: 802

Answers (1)

user9741470
user9741470

Reputation:

I've found a solution for this. After reading the related section of the documentations, I've solved using the convert_urls option of the editor. This is the third time I use this kind of editor, so I didn't know about all available options.

https://www.tiny.cloud/docs/configure/url-handling/#convert_urls

example code:

$(document).ready(function(){

  tinymce.init({
    selector: 'textarea',  // change this value according to your HTML
    convert_urls: false
  });

});

Upvotes: 2

Related Questions