Hi-
This feature request is related this thread:
http://forum.coppermine-gallery.net/index.php/topic,51660.0.htmlCPG is great because it allows for storage of a lot of the attributes of image and other files in the database, without regard for where the actual files are in the filesystem. However, it's currently not possible to completely separate the storage of files from CPG, by placing the 'albums/' directory outside of the CPG webroot. Currently, CPG only stores one value for the path to the albums in the 'fullpath' variable in the config table.
There are many reasons why it would be desirable to have flexibility in this regard.
As the number of files inside the 'albums/' directory grows large, copying or backing up the entire 'albums/' directory every time you want to do a server move or upgrade can be problematic. Also, customers with large numbers of files will want to be able to move the file storage location to separate partitions, devices or servers for performance optimization reasons.
Fortunately, this is not a new problem. Other open source applications have solved this problem by storing two values for paths to certain types of files:
1) File path (physical) - the full path to the actual location of the files in the filesystem (used for backend application reads/writes to files)
2) URL path (logical) - the path to be appended to the URL (output to the browser for HTTP requests for files)
Example "File path": '/var/www/html/files'
Example "URL path":'
http://www.companyserver.com/images/'
With this type of separation, it would even be possible for very high-volume customers to place their album files on a separate server (or even several mirrored servers behind some type of load-balancing proxy), with the album server accessible via NFS for reads and writes by CPG's background processes, and the servers themselves accessible directly via end user web browsers.
To use a programming analogy, CPG doesn't necessarily need to "own" the gallery files as long as it can pass end users a pointer (URL path) to the files.In addition to giving customers flexibility with regard to storage of gallery files, there would be benefits when upgrading, since customers could have a configuration like this:
/path/to/cpg_image_data/albums <-- storage location of 'albums/' data
/home/coppermine/cpg1.4.13 <--- separate CPG installs, each with own codebase and DB, but all pointing to same 'albums/' "File path"
/home/coppermine/cpg1.4.15
/home/coppermine/cpg1.4.16
/home/coppermine/cpg1.5-pre-alpha
To do a non-destructive upgrade, customers could simply unpack the new CPG into its own directory tree, load a copy of the CPG DB for the new install, run the DB upgrade script, and set the "File Path" to '/path/to/cpg_image_data/albums'. For customers that wanted to have separate sets of content for the different installs, this would still be possible by changing the "File path" to different locations.
Each install could have its own "URL Path", which would allow customers to implement the standard operating environment for enterprise software development (4 environments: Development, QA, Test, and Production), by mapping Apache aliases (or even virtual servers) to the different installs of CPG. For example:
Alias /development /home/coppermine/cpg1.6-pre-alpha
Alias /qa /home/coppermine/cpg1.5-pre-alpha
Alias /test /home/coppermine/cpg1.4.17
Alias /production /home/coppermine/cpg1.4.16
When the new version has been fully tested, moving users over to production would be simply a matter of changing the alias in Apache.
So what would be involved in making this change?It's possible that all that would be needed is:
1) Two new DB config values with names '$CONFIG['album_url_path']' and '$CONFIG['album_filesystem_path']' to replace the existing '$CONFIG['fullpath']'.
2) Modification of current references to '$CONFIG['fullpath']', where appropriate. This would mean referencing '$CONFIG['album_filesystem_path']' when CPG is accessing the filesystem directly, and referencing '$CONFIG['album_url_path']' where CPG is building an URL reference to send to the browser.
I am not a CPG expert, but I did a 'grep -r -I 'fullpath' *' on all the files in the CPG root and it showed that the 'fullpath' config value is only referenced in about 25 files (not including lang files). So it might not be a hugely complicated change.
I'm not sure how many enterprise customers are using CPG currently, but this would be an attractive feature for customers with large amounts of picture and other data to manage. And as current CPG users see their album directory getting bigger and bigger, I bet many of them would find it useful as well.
Does this sound doable?