View Full Version : image path problem...

08-24-2004, 03:12 PM

I'm at the moment coding a wysiwyg editor for a client.. it's all complete except for a problem when inserting image. I've built an image library and users insert files that way... the problem is the image paths...

the editor is in the root folder, but the code files are in "editor" folder. The problem is that the main editor page images do not show, as they think the paths are wrong.

Is there a way I can set a variable, eg:

path = "http://blah.com/" and search through the contents of the HTML replacing every instance of <img src=".... with

<img src=" + path + ..... so the relative paths are temporarily set as absolute?

I have the HTML in a string, so I guess it's just a find and replace? Any help is much appreciated!!

Willy Duitt
08-24-2004, 03:24 PM
<base href="........

08-24-2004, 03:30 PM

/me hits head on wall....

thanks willy!