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

php-issues-bugs-solutions

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.

 • Instagram • 

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

  • Sushant
    April 19, 2010 at 12:49 pm

    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

  • Sushant
    April 19, 2010 at 6:19 pm

    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

  • Sushant
    April 23, 2010 at 5:29 am

    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);

  • Sushant
    April 23, 2010 at 10:59 am

    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);

  • Rakshit Patel
    April 26, 2010 at 12:44 pm

    @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.

  • Rakshit Patel
    April 26, 2010 at 6:14 pm

    @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.

  • Joe
    August 23, 2011 at 4:40 pm

    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…

  • %spi nfile-generic_anchor_text.dat%
    December 25, 2012 at 1:48 pm

    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.

  • New Motorcycles
    June 14, 2013 at 6:44 am

    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 *

Sponsors

Sponsors

Recommended

DHgate Computers
DHgate.com - Computers, Cell Phones & more
  • We find everbuying built in php and use css to control the style.

About Author

PHP Freelancer

PHP Freelancer I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I am here to share all my developing knowledge with you people. For Hire PHP Developer India, contact me.
Follow on twitter: @raxit4u2

Get Free Programming Tutorials:

Become a Fan

Popular Topics

Recent Posts

Most Popular

Recent Comments

Get a Free Quote
$
$
$
Security Question: 3 + 8 = ?
$