Page 1 of 1
TinyMCE: incorrect relative image path
Posted: Tue Aug 08, 2006 12:55 pm
by hansom
Hi,
When using the TinyMCE module and inserting images an incorrect path to the image is used for the img tag. I click the 'Insert/edit image' button, click the 'Browse' button and choose an image. The path that then is placed in the 'Image URL' field looks like this:
uploads/images/logo1.gif. But this is the relative path. When browsing the public web page the path is incorrect, and should instead be
/subdirectory/uploads/images/logo1.gif.
In config.php the value for $config['image_uploads_url'] is
http://localhost/subdirectory/uploads/images but TinyMCE doesn't seem to honor this. Can anyone confirm this?
Re: TinyMCE: incorrect relative image path
Posted: Tue Aug 08, 2006 2:42 pm
by Dr.CSS
Does the image show up on the rendered page?
Have you added the {metadata} tag in between the ?
Re: TinyMCE: incorrect relative image path
Posted: Tue Aug 08, 2006 5:10 pm
by hansom
mark wrote:
Does the image show up on the rendered page?
No, it doesn't. Only on the admin page.
mark wrote:
Have you added the {metadata} tag in between the ?
No I had not. But when I did I noticed that it inserted a base element, which of course solves the path problem. I did not know that the metadata tag automatically inserted a base element. But I'd rather not use the base element, I prefer absolute urls - I want to be able to have a link with the href 'foo/bar' and not have it automatically changed to '/basehref/foo/bar'.
So do you think there is a way to have TinyMCE insert absolute urls?
Re: TinyMCE: incorrect relative image path
Posted: Tue Aug 08, 2006 6:20 pm
by Dr.CSS
I'm thinking it will work if you add / to the front of the path as in Image URL /uploads/images/logo1.gif. when you add an image
Re: TinyMCE: incorrect relative image path
Posted: Tue Aug 08, 2006 6:37 pm
by hansom
mark wrote:
I'm thinking it will work if you add / to the front of the path as in Image URL /uploads/images/logo1.gif. when you add an image
Yeah, I thought so as well. But unfortunately it doesn't like that and changes the leading slash into
../ which obviously won't work...
Re: TinyMCE: incorrect relative image path
Posted: Wed Aug 09, 2006 11:00 am
by hansom
OK, by changing the value of $config['uploads_url'] in the CMS Made Simple Configuration File to /cmsms/uploads leaving out the protocol and host parts and then changing the value of $Config['UserFilesPath'] in \modules\TinyMCE\tinymce\jscripts\tiny_mce\plugins\simplebrowser\connectors\php\config.php from str_replace($config["root_url"].'/', '', $config["uploads_url"])."/" to $config['uploads_url'] I managed to get the image browser to use a correct url, e.g. /uploads/images/logo1.gif. I wonder why this isn't the default valute of $Config['UserFilesPath']...
Besides having to remember to change the TinyMCE config.php file this is a solution that I'm satsified with. The only thing is, is it ok to set the value of $config['uploads_url'] /cmsms/uploads and leave out the leading parts? Or will that break stuff?
Re: TinyMCE: incorrect relative image path
Posted: Mon Mar 26, 2007 10:45 am
by lupker
Hi Hansom,
I reply on a feed from a while back, about the incorrect relative image path for TinyMCE.
Your instructions were pretty clear to me, but the fact is that the browser does use the right paths, but after the image is pasted into the editor, it changes the path back.
Also manually changing the url in the html output does not work. It keeps filtering my links.
You say your solutions works, maybe you can give me a hint to make this work for me?
Thanks!!!
Greetz,
Mark