TinyMCE inserts image url adding extra slash and making link broken

I am using TinyMCE in my php pages and save to db.

Everything works great except when you insert an image.

I am making a broken link ... I checked for url in firebug and this is the result:

<img src="\"http://ysite.com/images/preview.jpg\"">

      

it should be:

<img src="http://ysite.com/images/preview.jpg">

      

He got extra: \ "at the beginning and end.

+3


source to share


2 answers


If you don't have the option to disable magic quotes , then you should enable validation and handle the slash description accordingly.

This makes the portability of the code much easier if the code gets into other settings.



<?php
if (get_magic_quotes_gpc()) {
    $content = stripslashes($_POST['content']);
} else {
    $content = $_POST['content'];
}
?>

      

+4


source


Try to use html_entity_decode()



+3


source







All Articles