Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
image upload works but I get no previews and wrong image link. images are being uploaded to sites/whatever.com/files/u* but inserted links and preview point to /u*/
i am using imce with ckeditor
Comment | File | Size | Author |
---|---|---|---|
#45 | 846136_committed.patch | 1.22 KB | dnotes |
#33 | set_file-url.patch | 630 bytes | StevenWill |
Comments
Comment #1
tancSame issue noted here. Using 6.x-2.x-dev with TinyMCE and IMCE wysiwyg bridge. Url returned by IMCE is incorrect and does not have the full files directory path (e.g. missing sites/default/files/)
Comment #2
priyodevil CreditAttribution: priyodevil commentedany ideas on a fix??
Comment #3
rjacobs CreditAttribution: rjacobs commentedI noticed a similar (but not exact) problem with 2.0-beta3. Uploads worked but the images were always broken in the browser. It turns out this was because IMCE was trying to access them via "s/default/files/"
instead of "sites/default/files/" (notice that the "sites" part was just cut-off).
I was having this problem on a local (MAMP) server that was running under the domain "localhost:8888" (non-standard port). When I moved the same install (mirrored code and database) to a public hosting environment (without the non-standard port) everything worked fine.
I know this could easily be because of different versions (php, MySQL, etc.) between server environments, but because the issue was path-related, my best guess (in my situation) was that is had something to do with the port.
Again, this could be a completely different problem, but I wanted to make a note here in case it helps anyone. Regardless, if IMCE could in fact be confused by a non-standard port, this would certainly seem like a bug.
Cheers,
Ryan
Comment #4
priyodevil CreditAttribution: priyodevil commentedI am running this on production server. No port issues here. Problem persists.
Comment #5
priyodevil CreditAttribution: priyodevil commentedAny ideas anybody? In desperate need of a fix.
Comment #6
ufku CreditAttribution: ufku commentedAs rjacobs stated this was a port issue and fixed in the dev branch.
Run update.php, clear the caches.
Comment #7
priyodevil CreditAttribution: priyodevil commentedDone. Problem still persists.
Comment #8
ufku CreditAttribution: ufku commentedLook at the page source and find out what IMCE defines as the base file path. Look for something like
"furl": "http://example.com/files"
Comment #9
shopdogg CreditAttribution: shopdogg commentedI have the same problem. Imce defines the base file path like this
"furl":"\/"
Comment #10
ufku CreditAttribution: ufku commentedWhat is your "File system path" defined at admin/settings/file-system?
Comment #11
shopdogg CreditAttribution: shopdogg commented"File system path": sites/default/files
Comment #12
bonked CreditAttribution: bonked commentedHad the same issue after upgrade last night.
Changing line 710 of inc/imce.page.inc from:
to:
Seems to have fixed it for us. I don't normally like to hack away like that - but I'm kind of swamped, will try to make a proper patch this evening.
Comment #13
priyodevil CreditAttribution: priyodevil commented$imce['furl'] = file_directory_path() . file_create_url('');
but inserted image still points to wrong location
the fix that worked for me is
$imce['furl'] = "/" . file_directory_path() . file_create_url('');
on my dev version of imce this is at line 720
Comment #14
tancYou'd probably want:
$imce['furl'] = base_path() . file_directory_path() . file_create_url('');
Base path should always be used as it will point to the root directory of the Drupal install.
Comment #15
ufku CreditAttribution: ufku commentedHow can this function return
/
forfile_create_url('')
?Can anybody test the result of
file_create_url('')
?Comment #16
shopdogg CreditAttribution: shopdogg commentedI have less experience, but if you can tell me how to test, I will do it.
Comment #17
ufku CreditAttribution: ufku commentedEnable PHP input format and go to node/add/page.
Preview the content(no need to save)
.
Also try it with some real filepaths, ex: file_create_url('sites/default/files/foo.jpg')
Comment #18
shopdogg CreditAttribution: shopdogg commentedI tried that without and with different filepaths and the preview returned every time
Parse error: syntax error, unexpected T_FUNCTION in /www/htdocs/w00cd699/includes/common.inc(1697) : eval()'d code on line 2
Comment #19
ufku CreditAttribution: ufku commentedThis is the correct one
Comment #20
shopdogg CreditAttribution: shopdogg commented<?php print file_create_url(''); ?>
returns/
<?php print file_create_url('sites/default/files/example.jpg'); ?>
returnshttp://example.com/sites/default/files/example.jpg
Comment #21
ufku CreditAttribution: ufku commentedCheck the file_create_url function in includes/file.inc
Is it the same as #15?
Comment #22
steinmb CreditAttribution: steinmb commentedHi
Had the same problem with D6.17, MAMP and latest stable IMCE. It kept inserting/using in the image browser —the path s/[filepath] but updating to the last dev. release fixed this/my issue (@ufku thanx!)
Make sure to delete the old imce dir before installing the new release to make sure you do not have old code/files laying around and to a "drush cc all" to clean out your caches.
Comment #23
technicka CreditAttribution: technicka commented#14 is what worked for me. Before hand my URLs were missing the "sites/sitename/files". Also this must have something to do with ports as mentioned above, as when I was on my local machine this worked fine and then transferred to web host and it stopped working.
Also, was running the IMCE dev version and this didn't solve anything despite running update.php and clearing cache.
Comment #24
roneill CreditAttribution: roneill commented#14 Worked for me as well. It is now line 721 in inc/imce.page.inc. A fix to this would be excellent.
Comment #25
mani.atico CreditAttribution: mani.atico commented#14 worked for me.
Comment #26
ufku CreditAttribution: ufku commentedObviously, this issue is specific to a minority. The solution in #14 will break the rest.
You have to find what you have in common and identify the source of the problem.
Please see my previous comments.
Comment #27
simeIt's a Pressflow bug.
http://drupal.org/node/839282#comment-3168332
https://bugs.launchpad.net/pressflow/+bug/597718
I suggest "won't fix".
Comment #28
simeIf you are brave (and it's not a complete fix) you might maintain a patch on Pressflow until it's fixed. I'll just post a hint here, because I don't claim that this solution is a fix but may help those in a bind.
Just before "// Shipped files." in file_create_url() in file.inc add this:
Comment #29
jrabeemer CreditAttribution: jrabeemer commented#14 worked for me. FYI, I'm not using Pressflow at all.
Comment #30
jrabeemer CreditAttribution: jrabeemer commentedrebasing
Comment #31
jleinenbach CreditAttribution: jleinenbach commentedsubscribe
Comment #32
ufku CreditAttribution: ufku commentedIf you mark an issue as a bug, please write down the steps to reproduce it. So, anyone can reproduce it.
And please read all the comments and try to help debugging if you think it's a bug.
You can start by a clean drupal install with only the buggy module enabled and test.
Comment #33
StevenWill CreditAttribution: StevenWill commentedThe following patch changes "$imce['furl']" to use "file_directory_path()" instead of "file_create_url('')". This method is compatible with the drupal file API and works for both Drupal and Pressflow. It also makes more since to call the directory when dealing with files. Please test so we can get this submitted.
Comment #34
TravisCarden CreditAttribution: TravisCarden commentedsubscribing
Comment #35
chadd CreditAttribution: chadd commentedsubscribe
Comment #36
ufku CreditAttribution: ufku commentedThis is fixed in 2.x-dev(2010-Aug-17)
http://drupal.org/cvs?commit=408374
Comment #37
chadd CreditAttribution: chadd commentedyou linked to August 16, 2010, is that the correct dev version that has this fix?
Comment #38
ufku CreditAttribution: ufku commentedDevelopment releases are built nightly. A commit is included in the following day's release.
Comment #39
chadd CreditAttribution: chadd commentedcurrent dev release fixed it for me.
thanks!
Comment #40
kwhatcher CreditAttribution: kwhatcher commentedConfirm Dev release fixed issue
Thanks!
Comment #41
boran CreditAttribution: boran commentedHi,
I just upgrade to dev, and tried to insert an image.
The patch is now /sites/wingo/filesu9/connect1.png"
There is a "/" missing between "files" and "u9".
I'm using pressflow.
The upgrade changes the follwoing lines for me:
Changing the relevant line to:
fixed it for me. Could this be commited too please?
Comment #42
ufku CreditAttribution: ufku commentedimce.js was also patched. clear the caches and make sure the new one loads.
Comment #43
boran CreditAttribution: boran commentedYes, you have a point, on flushing caches it was no longer necessary to add the "/".
Comment #45
dnotes CreditAttribution: dnotes commentedJust adding a patch from http://drupal.org/cvs?commit=408374 for my drush make files - I don't wanna use the dev version for makefiles, so until a new RC comes out I'm going to patch RC1 with this. Thanks for the fix.