okay as it seems we can't post in the admin functions forum i'll post my hack here, hopping it'll get noticed, rated and maybe posted where it belongs :)
so this hack is of course about the topic i investigated in this thread.
I made several versions of my hack to be able to store picture on remote servers and finally decided to only keep the very simplest one and post it here..
For the moment i'd say it's still in beta as it's only been tested by myself.. And you could call it "Pseudo Remote Gallery" hack as i'll explain how it works below :
Basically this hack will let the gallery use pictures that are located on a different server than the local server and still behave just as if the pictures where stored locally..
## Requirements ##
Php with "http" fopen support
CPG 1.4.x (tested on cpg 141 beta), my admin tool "files.php" should also work on cpg 1.3 with the proper "db_query" function modifications. The modifications to themes.inc.php could probably be ported to 1.3 too.
a properly formated remote file list.
## Installation ##
In the Config section "Custom fields for image description", set "Field 4 name" to "Remote URL". Be carefull no typo will be tolerated..
then put the file "files.php" into the root of your cpg gallery and put the file "themes.inc.php" in the include directory.
You can rename "files.php" to anything the script should still work.
## How does it work / What does it do ? ##
"files.php" is a batch add tool, to add remote pictures to your gallery. It's built on the "timer.php" script i found in this forum's admin tools scripts..
You can find details about that batch add script here :
http://forum.coppermine-gallery.net/index.php?topic=13949.msg102336#msg102336basicaly it creates categories/albums based on paths provided in the remote pictures list you'll provide.
So the important thing is to provide my script with a properly formated list of remote files and locations to store the local pictures to.
The list should always have the following format :
/relative/album/path/
http://www.domain.com/direct/path/to/the/picture.jpg..
..
..
/relative/otheralbum/path/
http://www.domain.com/direct/path/to/the/picture.jpg*
..
..
and so on
"/relative/album/path/" is the path that will be used to both create the category/album structure in your gallery AND download/store the pictures under your albums/ directory..
so in my above example list, the first picture would be downloaded to albums/relative/album/path/, the categories "relative" > "album" would be created if not existing and the album "path" would be created inside the "album" category..
okay my choice of words for the path was really poor but anyways it's quite simple, right ?
Once the download of the remote picture is completed successfully the "thumb" and "normal" pictures will be created according to your gallery configuration, meaning the normal picture does not have to be created/stored locally if you don't use normal pictures or if it's not required according to the source picture size and your max sizes configuration..
Last but not least the source picture we've just downloaded will be removed and replaced by an empty file of the very same name. This empty file is necessary for later dupe checks to make sure the picture is already present in the gallery and use another filename to perform the download and storage of thumbs/normal pics..
Well that's about it.. Oh yeah of course the source URL is stored inside the "Field 4 name" field of the picture so it can be used to display the fullsize picture inside your gallery.
now when you browse your gallery, thumbs and normal pics are used locally but the fullsize picture is fetched from the source url..
That works both when using the fullsize popup from a normal picture display but also when not using any normal picture at all..
And of course local pictures can still be used !
The gallery behaviour towards local pics in unchanged, so you can potentially mix local and remote pictures as you wish..
## A few further explanations on the batch add script and the list format ##
any line starting with "/" will be considered a path and treated as such.
A path will be created prior to adding any pictures to it so even though no pictures follow the path it would still be created !
any line starting with "http" will be considered a source url, case sensitivity is not a matter (HttP would be recognized as well).
any other line will be ignored !
so if you screw up your paths some pictures could end up inside the previous path. Coz if the new path is faulty it will be ignored and the latest recognized path would still be used for the next pictures..
Pictures following a "/" path will be skipped. That would mean adding pictures with an album ID of 0 and those pics cannot be sorted with the current admin tools of CPG so i decided to skip those "unsorted" pictures..
## IMPORTANT LIMITATIONS ##
the main cpg hack is located in the include/themes.inc.php script which stores functions to display the pictures in the gallery.
As i see it those functions can be localized inside a CPG theme, meaning that with such a theme my modifications in the original include script would be overriden and the hack would no longer work !
If your theme is using its own display functions you have to manualy apply my hack to them. Search for "user4" in the include/themes.inc.php and patch you theme functions.
You can "see" a demo of the hack here :
http://capsnscans.free.fr/cpg/all the source pics are remote, thumbs and normals are local as explained above.
I still consider this hack beta because there must be some things i've missed or skipped being focused on my own way of using cpg..
Let me know if this hack works fine for you and if you have suggestions/questions, i'll be glad to take a look at them.
.flux
## Make sure you check my posts below they will have the latest versions of this hack ! ##