Closed (fixed)
Project:
IMCE
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Sep 2006 at 04:43 UTC
Updated:
19 Oct 2006 at 16:12 UTC
When using multi-site setup, instead of generating paths to
/sites/www.example.com/files/
generate paths to
/files/
This makes content from a multi-site database portable to different sites, such as a testing site, but it depends on a web server alias from /files/ to the correct directory. This feature does not set up that alias.
I'm including a patch that implements the feature and includes a checkbox to turn it on. It's off by default.
Comments
Comment #1
mj2308 commentedhi mcary,
not sure if this patch addresses the issue (not really sure whether you are trying to get the paths to go to /sites/www.example.com/files or to /files/, took a look at the code and unfortunately I'm not a coder), but my IMCE has this problem: I am installing Drupal on example.com/test (ie in /home/user/public_html/test) and my files are uploaded to /home/user/public_html/test/sites/default/files/, when I uplaod using IMCE, checking with FTP, the image is uplaoded, but the Image URL given by TinyMce/IMCE is wrong, it lists /test//home/user/public_html/test/sites/default/files. Of course, the image doesn't show up, and not just that, shouldn't the Image URL be relative ie simply "sites/default/files" so that in the future when I move Drupal to my root directory I do not have to edit all the image links as well?
Comment #2
mj2308 commentedhi Mcary,
decided not to be lazy and applied your patch, it doesn't solve my problem sadly =( I'll file a separate issue, unless this patch is supposed to help me but somehow is not working (I'm not really sure what this patch is meant to do sorry heh)
Comment #3
ufku commentedmcary, thanks for the patch but i dont have the appropriate conditions to work on this.
anybody interested in this feature?
should i mark this as won't fix.
Comment #4
lisa commentedHas anyone installed this patch successfully? I tried and got the following error messages:
patching file imce.module
Hunk #1 FAILED at 72.
Hunk #2 succeeded at 324 with fuzz 2 (offset 33 lines).
1 out of 2 hunks FAILED -- saving rejects to file imce.module.rej
I agree with mj2380 (see #1) that it would be VERY useful to have the image URL be relative so that in the future when I move a test site to its server, it is not necessary to edit all the image links as well.
If anyone could help solve this issue, it would be much appreciated.
Comment #5
ufku commentedimce returns paths relative to drupal directory. mcary's case is a bit special. he uses path aliases which need to be setup in the server and will make /sites/example.com/files/ = /files/
sort of this can also be achieved by drupal without setting up aliases in the server. It's "private downloads". if you enable it, your file directory(whatever it is) will be aliased by system/files url.
lets say, you have "image.gif" under your imce directory "u1" and your drupal file directory is "sites/example.com/files".
with public downloads your image path is "/sites/example.com/files/u1/image.gif" and it will later break if you change drupal file directory to "files" or anything.
with private downloads your image path is "/system/files/u1/image.gif" and will not break as long as you have "u1/image.gif" under drupal file directory that can be changed to anything.
however, "private downloads" is slow since it requires some extra process. And switching between these two download methods breaks the file links in your site. if you start with private downloads you should go on with it.
Comment #6
lisa commentedHi ufku,
Thanks for your answer and for building such a great module. I know many others have been hoping for a better way to integrate images into nodes, and I really appreciate your work.
I am still a bit confused about the paths generated by imce. It seems my paths to images are going to break when I move my test site to a server. Let me explain what I am seeing.
I never messed with and am not using "private downloads." I don't even know where to find that option. Under admin->settings->imce I chose use a shared folder and created a folder called images_imce located at hope/files/images_imce
I created a test site on my iBook. When I use imce to add an image to a node, the image path created is
/~lisa/hope/files/images_imce/image.jpgBut won't that path break when I move the site to the server? To me, it seems the path should be:
/hope/files/images_imce/image.jpgWhat am I missing (not understanding)?
Comment #7
ufku commentedlisa, it seems that your drupal file directory path is not relative. check it under file settings in admin/settings page. make it relative to your drupal installation. if your drupal is under "hope" directory then make the path just "files".
Comment #8
lisa commentedufku,
Thanks again for trying to help.
Yes, my drupal is under "hope" directory.
I checked under admin->settings->file system settings and file system path was set to "files".
Still when I use imce to add an image to a node, the image path created is
/~lisa/hope/files/images_imce/image.jpg(My understanding is that ~lisa is a shortcut for /User/lisa/Sites on iBook.)
Since the file system setting is correct, any other ideas as to why imce doesn't seem to generate a relative path when I use it?
Comment #9
ufku commentedok it's clearer now. actually your case is related to base tag that was removed in drupal4.7. since there is no base tag, URLs are created relative to the domain(hostname). and links are broken after moving a site from a subdirectory to the root. As stated in the replies to http://drupal.org/node/58106#comment-110140, you can use a subdomain for development site. If you are working on your own computer, you can also create a virtual domain pointing to your sub-directory.
there is no solution in drupal or imce side since when you remove for instance the "/~lisa/hope/" part from the URL, it will only work on main page and will break on sub pages. to make it clearer, suppose you have an image with src="files/images_imce/image.gif" in "http://localhost/~lisa/hope/node/x" page. it wont be displayed since it will be pointing to "http://localhost/~lisa/hope/node/x/files/images_imce/image.gif". that's way drupal URLs are relative to hostnames.
Comment #10
ufku commentedtopic is out of imce.