Page 1 of 1

Change uploads url

Posted: Wed Jun 11, 2008 8:42 am
by xcheffo
I would like to have my uploaded files stored into a separate directory, but I would like to have them mapped on the document root.

For example, I want to have

Code: Select all

#Where are uploaded files put?  This defaults to uploads.
$config['uploads_path'] = '/some/where/cmsms-root/uploads';
#Where is the url to this uploads directory?
$config['uploads_url'] = $config['root_url'] . '/';

#Default path and URL for uploaded images in the image manager
$config['image_uploads_path'] = '/var/www/cmsms-new/uploads/images';
$config['image_uploads_url'] = $config['root_url'] . '/images';
so that I still access my images on
http://www.example.com/cmsms-root/images/logo1.gif
instead on
http://www.example.com/cmsms-root/images/[b]uploads[/b]/logo1.gif

My config is

Code: Select all

CMSMS 1.2.5
Server version: Apache/2.2.3
mysql  Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2
PHP 5.2.0-8+etch11 (cli) (built: May 10 2008 10:46:24)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

Re: Change uploads url

Posted: Wed Jun 11, 2008 7:45 pm
by Dr.CSS
Well you can mess with it, but best practices is to have them in, for images used in templates, uploads/templatename folder or some such and for images used in pages, editor inserted images, uploads/images even uploads/images/anotherfolder this is so they can see them when picking images...

The way you are trying is some thing that is most times how static HTML/CSS sites are set up, like I did for years...

The root image folder is for images used in the admin interface...

Re: Change uploads url

Posted: Thu Jun 12, 2008 6:42 am
by xcheffo
Thank you, mark. The point about the separating template images from the content images was really good.

My goal, though, is different:
I simply want to strip the uploads part from the image url. I still prefer to have the uploadables in separate directory (on my server file system), as you suggest, and if this directory is the deafult - that is the best.

Moreover, I believed this is perfectly achievable with proper configuration in config.php, but it does not worked for me.

Re: Change uploads url

Posted: Thu Jun 12, 2008 7:06 am
by Wiedmann

Code: Select all

$config['image_uploads_path'] = '/var/www/cmsms-new/uploads/images';
$config['image_uploads_url'] = $config['root_url'] . '/images';
For this configuration you must move the files in the directory:
"/var/www/cmsms-new/images/cms/"
to:
"/var/www/cmsms-new/uploads/images/cms/"

and then remove the directory:
"/var/www/cmsms-new/images/"