Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

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.
Share:

9 Comments

  • Sushant

    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

    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

    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

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

Leave a Reply

Your email address will not be published.