Absolute url plugin for cpg1.5.x Absolute url plugin for cpg1.5.x
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Absolute url plugin for cpg1.5.x

Started by Αndré, November 09, 2010, 03:23:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Αndré

This plugin is the result of a support request by shiftsrl. He asked for a method how he can move the albums directory to another server to save bandwidth.

In fact, this plugin doesn't move the albums directory anyway. If you install the plugin, it places the URL of your Coppermine gallery folder in front of all pictures. Then you can configure the plugin using the plugin manager to set a different URL, where you have synced your whole albums/ directory! This plugin adds no automatism. You're responsible to keep that directories always up-to-date!

shiftsrl

Thank you again Andrè. I'm uploading all the images on a CDN and I'll put the plugin at work asap!
Shift Srl
*Link Removed*

caps

Hello,
I found this plugin and I used it. I explain my situation:
until last month in an old server I had:

www.mysite.xx            -> the main site
www.mysite.xx/2010   ->cpg for the 2010 year
www.mysite.xx/2011   ->cpg for the 2011 year

and the folders on the server was:
/            ->root, for the main site
/2010     ->cpg 2010 folder
/2011    ->cpg 2011 folder
/images ->image folder for all the site (for cpg 2010 and 2011 and main site)

I configure: URL of your coppermine gallery folder :   www.mysite.xx/2010/     (and www.mysite.xx/2011/ )
The album directory :  ../images/

and all was fine.
Now I have a new server (where I can set up subdomains) :

www.mysite.xx    -> the main site
2010.mysite.xx     ->cpg for the 2010 year
2011.mysite.xx     ->cpg for the 2011 year

and the folders on the server are:
/            ->root, for the main site
/2010     ->cpg 2010 folder
/2011    ->cpg 2011 folder
/images ->image folder for all the site (for cpg 2010 and 2011 and main site)

I configure: URL of your coppermine gallery folder :   2010.mysite.xx/     (and 2011.mysite.xx/ )
The album directory :    ../images/

I see the images (although they are not synchronized) but if I check the url of the images I see  img src="http://www.mysite.xx/../images/ ......" (and batch works on the /image folder  :) )

but if I change the album directory to  images/    cpg show the images only if the images are synchronized and the url is correct img src="http://www.mysite.xx/images/ ...... "

Is possible to disable the sync check?

Thanks

Claudio
Caps

Αndré

Actually there's no sync check.


Quote from: caps on July 06, 2011, 12:47:16 PM
I see the images (although they are not synchronized) but if I check the url of the images I see  img src="http://www.mysite.xx/../images/ ......" (and batch works on the /image folder  :) )
So everything works as expected, but you want to remove the
../
from the url?

caps

thanks for the reply

Yes, if it is possible to remove " ../ " will be better

if I change the album directory to  images/    cpg show the images only if the images are synchronized  ( root/2011/images/   and root/images/ )

Thanks again
Caps

Αndré

Please try the following. In codebase.php, find
$pic_row['url'] = $prefix.$pic_row['url'];
and replace with
$pic_row['url'] = $prefix.substr($pic_row['url'], 3);
(not tested).

caps

Yes, it work ! Thank you

in the next day I will check the batch upload

Thank you again
Caps

caps

All works fine  :)

Thanks

now I have another problem with cache, I think  :-[
here the post http://forum.coppermine-gallery.net/index.php/topic,73394.msg353923.html
but the problem remains even without this plugin
Caps

Αndré

Quote from: caps on September 07, 2011, 12:02:21 PM
here the post http://forum.coppermine-gallery.net/index.php/topic,73394.msg353923.html
I don't speak Italian, sorry.


Quote from: caps on September 07, 2011, 12:02:21 PM
but the problem remains even without this plugin
Then that issue is probably not related to the plugin and shouldn't discussed here.

Cmaniac

As I wanted to use another sever for hosting my albums (cost-performance optimization), I tried this plugin as it is the only (?) plugin/addon that can tell coppermine to look for files on another server.

To get started, I created a copy of my albums folder to my content delivery server and enabled the plugin - by then everything seemed to work correctly as photos were loading from the new server and the gallery was loading from the main server.

Then I decided to delete the /albums content from the main server so as to rely solely on the content delivery server. The problem I experienced is that after relying on the content-delivery-only server, coppermine wouldn't load a picture and instead all I could see is the nopic file (trash can) for every single file of the gallery, although the plugin was enabled and the files were accessible at the content delivery server.

Thanks.

Αndré

I assume this happens as Coppermine checks if the file is present on its "own" server. If it doesn't exist there, it uses that placeholder icon. You'll also get trouble if you try to delete files in your gallery, as Coppermine will also tell you that they don't exist. So it's recommended to let the albums directory as-is.

Consider this plugin rather as a quick hack, than a well-conceived solution.

Cmaniac

Because the files have to be on another server, how could that be possible even by modifying core files?

I know there is a function in /include/functions.inc.php and another in ecard.php (if relevant) that load thumb_nopic.png and I know that it is not recommended to edit core files of coppermine, but if coppermine keeps checking for files on the local server the plugin has much less uses than it can have.

In general, would it be possible for coppermine to stop checking for local files or just check at the remote server for the files in /albums directory by some modification in those core files?

Αndré

Just remove the check in include/functions.inc.php. Find
        if (file_exists($url_prefix[$pic_row['url_prefix']] . $localpath)) {
            $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($localpath);
        } else {
            $filepathname = 'images/thumbs/thumb_nopic.png';
            $pic_row['system_icon'] = true;
            if ($CONFIG['log_mode'] != 0) {
                log_write("File {$url_prefix[$pic_row['url_prefix']]}$localpath is missing.");
            }
        }

and replace with
        $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($localpath);


The initial idea was to save bandwidth, not disk space.