I have pages using FCKeditor in different folders. That gives problems with the relative urls of images.
I searched this forum, but noone seemed to have a nice solution, so I cooked one up myself.
- Open the file: FCKeditor\editor\dialog\fck_image\fck_image.js
- Search the function SetUrl() (line 399 in the version I use)
- add the folowing as first line: url="http://whatever.com/whatever/"+url;
To make it nicer, I added a var FCKConfig.ApplicationBase to the fck_config.js, so if ever need to copy the solution to another website, I can easely change it. So the line becomes: url = FCKConfig.ApplicationBase + url;
If you are using ASP.NET 2.0 like me and u specified the userfiles dir in the web.config with a ~. You can fix the problems that it causes here by adding: url = url.substring(2); This drops the first 2 chars (~/).
To make it even better, in the fck_config.js, I added folowing line: FCKConfig.ApplicationBase = window.location.href.substring(0,window.location.href.indexOf('FCKEditor/'));
You'll have to experiment with the last one if you didnt place the editor in the root.
I hope this helps someone!
Wed, 07/12/2006 - 03:59
#1
RE: Absolute image address FIX (+ASP.NET ~ fix)
This helped me, thank you very much for taking the time to post it!