Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Absolute url plugin for cpg1.5.x  (Read 16046 times)

0 Members and 1 Guest are viewing this topic.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Absolute url plugin for cpg1.5.x
« on: November 09, 2010, 03:23:55 pm »

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!
« Last Edit: November 10, 2010, 04:25:25 pm by Αndré »
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Absolute url plugin for cpg1.5.x
« Reply #1 on: November 10, 2010, 04:59:34 pm »

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

caps

  • Coppermine newbie
  • Country: it
  • Offline Offline
  • Gender: Male
  • Posts: 14
Re: Absolute url plugin for cpg1.5.x
« Reply #2 on: July 06, 2011, 12:47:16 pm »

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
Logged
Caps

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Absolute url plugin for cpg1.5.x
« Reply #3 on: July 13, 2011, 12:31:07 pm »

Actually there's no sync check.


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
Code: [Select]
../from the url?
Logged

caps

  • Coppermine newbie
  • Country: it
  • Offline Offline
  • Gender: Male
  • Posts: 14
Re: Absolute url plugin for cpg1.5.x
« Reply #4 on: July 13, 2011, 04:40:53 pm »

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
Logged
Caps

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Absolute url plugin for cpg1.5.x
« Reply #5 on: July 13, 2011, 05:03:59 pm »

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

caps

  • Coppermine newbie
  • Country: it
  • Offline Offline
  • Gender: Male
  • Posts: 14
Re: Absolute url plugin for cpg1.5.x
« Reply #6 on: July 13, 2011, 05:39:37 pm »

Yes, it work ! Thank you

in the next day I will check the batch upload

Thank you again
Logged
Caps

caps

  • Coppermine newbie
  • Country: it
  • Offline Offline
  • Gender: Male
  • Posts: 14
Re: Absolute url plugin for cpg1.5.x
« Reply #7 on: September 07, 2011, 12:02:21 pm »

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
Logged
Caps

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Absolute url plugin for cpg1.5.x
« Reply #8 on: September 07, 2011, 12:11:05 pm »

here the post http://forum.coppermine-gallery.net/index.php/topic,73394.msg353923.html
I don't speak Italian, sorry.


but the problem remains even without this plugin
Then that issue is probably not related to the plugin and shouldn't discussed here.
Logged

Cmaniac

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Absolute url plugin for cpg1.5.x
« Reply #9 on: July 22, 2012, 11:14:19 am »

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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Absolute url plugin for cpg1.5.x
« Reply #10 on: July 23, 2012, 12:05:57 pm »

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.
Logged

Cmaniac

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Absolute url plugin for cpg1.5.x
« Reply #11 on: July 24, 2012, 10:35:01 am »

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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Absolute url plugin for cpg1.5.x
« Reply #12 on: July 24, 2012, 10:40:43 am »

Just remove the check in include/functions.inc.php. Find
Code: [Select]
        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
Code: [Select]
        $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($localpath);

The initial idea was to save bandwidth, not disk space.
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 20 queries.