Sunday , 23 November 2014
Home » PHP Programming » Common Issues/Bugs » FCKEditor solution – How to store full URL for images (Show absolute path)
FCKEditor solution – How to store full URL for images (Show absolute path)

FCKEditor solution – How to store full URL for images (Show absolute path)

Hello Friends,

Today i came across a problem with FCKEditor. When i upload an image from fckeditor Browser Server option, it uploads correctly and insert image in content as well. But if i will send this content in email (for newsletter) than image will not be there as fckeditor inserts relative path in source of image. There should be a complete URL for image if you are sending this content into email. I was trying to find the way that how to insert the full url path when image uploads from FCKEditor.

I was in urgency so i found the alternative solution to make this problem fixed(solved) right away. What i have done is , find the relative path and replace it with full URL path. Look at below line which replace the absolute path inplace of relative path in image source tag.
 

$msg = str_replace('src="/userfiles/','src="http://www.example.com/userfiles/',$msg);

Thats it.

If you find any problem in this than let me know by comment.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.

Enter your email address:
 
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

9 comments

  1. Can anyone tell me how to store value of image url in fckeditor using asp.net  for ex(~/userfiles/user.jpg).
    I want to replace user.jpg with timestamp
    So pls help mw

  2. Can anyone tell me how to store value of image url in fckeditor using asp.net  for ex(~/userfiles/user.jpg).
    I want to replace user.jpg with timestamp
    So pls help mw

  3. But I don't know in which file i have to replace the following (For ex. Config.js or in another file)
    $msg = str_replace('src="/userfiles/','src="http://www.example.com/userfiles/',$msg);

  4. But I don't know in which file i have to replace the following (For ex. Config.js or in another file)
    $msg = str_replace('src="/userfiles/','src="http://www.example.com/userfiles/',$msg);

  5. @Sushant — You need put this statement  once you will get the content from FCKEditor(took content in $msg). Data from FCKEditor contains the relative path. Once you will write the above statement it will replace relative path with absolute path. So if you send the content in mail than image will appear in email.

  6. @Sushant — You need put this statement  once you will get the content from FCKEditor(took content in $msg). Data from FCKEditor contains the relative path. Once you will write the above statement it will replace relative path with absolute path. So if you send the content in mail than image will appear in email.

  7. No matter where to put this code, who can give me a tip? – I´ve searched for files with $msg, there are multiple and so don´t know to integrate to what file…

  8. Greate article. Keep writing such kind of info on your
    site. Im really impressed by it.
    Hey there, You have done a great job. I’ll definitely digg it and for my part recommend to my friends. I’m
    confident they’ll be benefited from this site.

  9. Thanks in support of sharing such a fastidious thinking, post
    is nice, thats why i have read it completely

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Sitemap