By dokumori on
I am using TinyMCE + IMCE to insert photos to newsletter. When I copy&paste the template for newsletter to TinyMCE window, absolute URL is converted into relative url.
I thought this may be an issue with TinyMCE, so I googled and found out TinyMCE has the option to enable/disable relative uls conversion:
http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=6134
However, when I saw the setting in tinymce.module, it was already disabled by default (line 493):
$init['relative_urls'] = 'false';
So I thought this conversion is done by IMCE, but I could not find relevant information or a way to fix it.
If you know how to solve this problem, please let me know.
Comments
IMCE always sends relative
IMCE always sends relative URLs to tinymce however it has nothing to do with conversion. If the URLs are converted to relative even after you enter them manually, then it is probably a tinymce issue. If you want IMCE to send absolute URLs then add path=location.host+path; to the first line of imceFinitor function in imce_browse.js
--Geneticists from METU
I followed your instruction,
I followed your instruction, modified imce_browse.jp and uploaded to the site. But then drupal became unstable and I could no longer create new nodes / make any change to settings. Do you think this is related to the change I made?
I rolled back imce_browse.js to the previous version and even reinstalled IMCE, but it didn't make any difference... Maybe this is caused by something else...
it's just a little
it's just a little javascript change. it doesnt affect drupal.
--
Geneticists from METU
Thanks. Yeah, that's what I
Thanks. Yeah, that's what I thought too... It's still a test site anyway. I will just reinstall everything.
Problem solved.
The problem was that convert_urls had to be 'false' (not 'relative_urls'). I found this in readme.txt of Pathfilter module.
I also followed ufku's advice and added path='http://' +location.host+path; to the first line of imceFinitor function in imce_browse.js.
Now it does not convert absolute URLs to relative URLs and inserted images have absolute URLs by default.
Thanks ufku for the hint, and that strange drupal error did not recur after reinstalling everything. Wonder what it was.
Thank you thank you thank you
Been going nuts with this all day. If anyone else is trying to add pictures to newsletters and getting stuck with relative paths, try this + the following settings in phptemplate_tinymce_theme:
$init['convert_urls'] = 'true';
$init['relative_urls'] = 'false';
$init['remove_script_host'] = 'false';
$init['document_base_url'] = "base_path()";
where does this go?
Hi Chu,
thanks for your help. I dug around a bit and found that this should go in modules/tinymce/tinymce.module - I found the function tinymce_config which looks like this:
/**
* Return an array of initial tinymce config options from the current role.
*/
function tinymce_config($profile) {
global $user;
down a few lines I found this:
$init['theme_advanced_resize_horizontal'] = 'false';
$init['theme_advanced_resizing_use_cookie'] = 'false';
and added your code below like this:
//selwyn add this 6-13-08
$init['convert_urls'] = 'true';
$init['relative_urls'] = 'false';
$init['remove_script_host'] = 'false';
$init['document_base_url'] = "base_path()";
//end selwyn add this 6-13-08
Hope this helps some folks out who are trying to figure out where to put this fix.
cheerio
Selwyn
ps. This appears to break relative paths - so if you have used imce to insert an image, your system can't find it at /files/image1.jpg, now it expects it to be at http://mysite/files/image1.jpg. I hope this is clear.
Selwyn Polit
https://www.drupalatyourfingertips.com/
no tinymce.module
Hi everybody,
I did not find "tinymce.module" (where is this?!), so I simply edited tiny_mce.js like the following:
Find:
relative_urls:1,remove_script_host:1,
and set both to 0, like this:
relative_urls:0,remove_script_host:0
For me: it works fine.
Thanks for the information!
Wow, what an annoying problem! I thought I was going crazy when I made changes (even in plain HTML), and my absolute links became relative ones by themselves. I really like relative links (well, starting with a /) in general, but they don't work in RSS/Atom streams.
Anyway, thanks to the info here, I was able to solve the problem quickly. Is there any chance to get the relevant setup options into tinymce and imce?
EagerEyes.org
Problem again in 5.1
This issue raises its ugly head again in 5.1. This is what I have in my tinymce.module (5.x-1.x-dev, tinyMCE 2.1.1.1):
How do I change that to not change my absolute URLs? Is there perhaps an option in tinyMCE now (couldn't find anything in the role setup, though)?
EagerEyes.org
Here's what I did
Here's what I did:
Find:
Replace with:
Find:
Replace width:
Works great!
Wonderful, thanks! Have you submitted this as a patch for tinyMCE?
EagerEyes.org
I haven't figured out how to
I haven't figured out how to write a patch yet, but I am planning to do so. Maybe someone is willing to help?
I don't know why I can't get
I don't know why I can't get this fix to work.. it's changing the URLs to absolute, but for some reason the images don't display. They are there if I go back to edit the page, but not when I view it. In the view page source code there is no reference to an image. Is this a drupal setting I need to change maybe?
Nevermind, I'm an idiot, I didn't realize you had to use unfiltered html. The fix worked great, thanks!
thank you for this
thank you for this !!!!!!
should be appplied
I checkd my tinymce module
I checkd my tinymce module file and can't find
Is this the wrong place to look?
I'm using Drupal 6.x tinymce-6.x-1.1-dev.tar
Nice one Skilip. I can help
Nice one Skilip. I can help you live with patching code ;)
I found a new way - this
I found a new way - this module helps http://drupal.org/project/abssrc
I don-t touch any files of imce or tinymce, but I see on html output of my rss feed, that pathesare correct. Well, i just installed module, so let`s see!
One problem - in 5 version autor used a bit of 6v code. There is a patch for it, but the autor of module didn`t upload a new version...
Well, lets see...
I have a similar problem.
I had a similar problem, thanks for the help! I had to change to
relative_urls: 0
remove_script_host : 0,
in both files, \sites\all\modules\tinytinymce\tinymce\jscripts\tiny_mce\tiny_mce.js and \sites\all\modules\tinytinymce\tinymce\jscripts\tiny_mce\tiny_mce_src.js
ursika I tried your
ursika I tried your suggestion and didn't work for me. I still have absolute path even after I clear cache :(... this is frustrating
The pathologic module solved
The pathologic module solved the problem....yeah! - great module!
http://drupal.org/project/pathologic