Hi there,
currently my Drupal installation is running fine. What annoyes me however, are the extremely long paths created by Drupal/Imagecache to locate an image. For example:
http://www.domain.com/sites/default/files/imagecache/s700-500/content_type/filename.jpg
Six (!) subdomains to reach the image!
The first three subdirectories are the location of my files directory, the others are used by Imachecache.
Is it possible to get the files from another location. eg http://files.domain.com/ so the path would be
http://files.domain.com/imagecache/s700-500/content_type/filename.jpg
Can this be done by using a symlink in Linux? Or even better: can I point Drupal to get his files from a external fileserver to get even better performance?
Comments
Wrong thing to worry about
Those are directories, not domains.
Length of request URI isn't a significant performance issue. Be happy that Drupal breaks the files directory into multiple subdirectories rather than throwing everything into one directory. Unix actually performs better under such circumstances.
You can easily make it
You can easily make it http://www.domain.com/files/imagecache/...etc... by using
- a symlink:
ln -s /home/...blah.../public_html/sites/default/files /home/...blah.../public_html/files- setting your (public) file system to
filesin the admin/settings/file-system pageand the only price will be some inconsistency with your old existing links in the content and in the 'files' table (which should still work anyway, since nothing was moved, and they are directly served by the webserver).
You can turn the public_html/files symlink into a files subdomain, but you can't tell Drupal's file system to use it in admin/settings/file-system. You can only enter a directory in that text box, and that is what Drupal is going to register in the 'files' table in the database. Of course you can always use subdomain links in the content manually and they will work.
Personally, because I always use multiple sites (for testing etc), I never leave a site's files in a /sites/www.example.com/files subdirectory because that would make the file paths unjustifiably dependent on the domain name, making it hard to move a site to and from localhost. I use /files/site-alias file paths instead.