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] 2   Go Down

Author Topic: Moving the 'Album' directory on another server  (Read 8851 times)

0 Members and 1 Guest are viewing this topic.

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Moving the 'Album' directory on another server
« on: November 07, 2010, 09:21:27 pm »

I've seen something around the forum but heve not fully understood what's the point. I would like to move all the albums directory on another server to offload the main server and save bandwidth.

In my gallery I'm the only user and I'm the only manager of the gallery. I create album and upload pictures. The other users can only see them but registration of new users is disabled. Also I don't use any plugin.

Is it possible to modify som configurations or some files to make this possible? In substance I would like that all the images displayed in the http://www.maindomain.xxx/gallery comes from http://www.imageserver.xxx.

If someone can explain me what to do, supposing it's not too difficult since I'm not a programmer, I can try it...

Thank you very much
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #1 on: November 08, 2010, 04:40:56 pm »

I've seen something around the forum but heve not fully understood what's the point
Please post the link. Afaik that's not possible, at least not out of the box. It may be possible with some automatic synchronization (mirroring) and some code adjustments. But that's no pretty solution imo.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #2 on: November 08, 2010, 04:54:49 pm »

The link I've seen are about a GSOC version or something like that but I think it's a proposal.

In any case why should I need automatic sync? I would like to upload the images on the CDN and letting coppermine take them from there. Are these modifications too difficult to list here?
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #3 on: November 08, 2010, 05:07:54 pm »

I don't know if it's possible to upload files directly to a CDN. The workaround a had in mind is the following. You upload the files regularly to your Coppermine gallery. Images are always included with a relative path like 'albums/userpics/10001/sunset.jpg'. Now we just add your CDN url (by changing Coppermine's code accordingly), resulting in an absolute path like 'http://shiftsrl.superdupercdn.com/albums/userpics/10001/sunset.jpg'. Now you have to sync your albums directory with the directory on the CDN and everything should work as expected. Of course it should be possible to let Coppermine upload the files automatically to the CDN, but that's probably harder to code.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #4 on: November 08, 2010, 05:21:59 pm »

Wow, sound fantastic. Now the question is: Where I've to modify the CPC code to include the absolute path to the images? That way I can make CPG serve the images directly from the CDN instead of the local folder.

If you can tell me where to put this absolute path I can test and let you know the results. I think this could be interesting for many people.
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #5 on: November 09, 2010, 11:22:25 am »

Please install that plugin and report if it works.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #6 on: November 09, 2010, 11:45:35 am »

Wow thanks!!! How can I configure it? Where can I insert the url of the images?
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #7 on: November 09, 2010, 12:39:00 pm »

Lol. Just a small error in reasoning :D

Open codebase.php, find
Code: [Select]
$CONFIG['ecards_more_pic_target']and replace with your CDN path.

Keep in mind that $pic_row['url'] can contain something like
Code: [Select]
albums/test2/test.jpg(= files in your album directory) but also default thumbnails that resides in the images directory like
Code: [Select]
images/thumbs/thumb_pdf.png
So you'll have to mirror at least those 2 directories.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #8 on: November 09, 2010, 01:21:32 pm »

There's something I've missed. This is the procedure I've followed

1 - I've created a category and an album inside that category
2 - I've batch added some pictures (locally these resides in albums/samples)
3 - I've mirrored the folder (samples) on the cdn (inside http://www.mycdn.com/images/albums/samples)
4 - I've put in codebase.php the url (that is http://www.mycdn.com/images/)

Browsing the gallery show me all the pictures but checking them I've seen that these are local and not loaded from the cdn. All the thumbs are in the same folder as images as thumb_nomeoftheimage.jpg

I've missed something?
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #9 on: November 09, 2010, 01:22:45 pm »

Please post a link to your gallery.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #10 on: November 09, 2010, 01:26:29 pm »

In any case I'm sure this one is the right direction to do this. If you want I can give you the url where I've uploaded some images on the cdn to test them...
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #11 on: November 09, 2010, 01:30:01 pm »

I don't need the CDN url, but the url of your Coppermine gallery. I want to check if the plugin doesn't work as expected or if you've done something wrong.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #12 on: November 09, 2010, 01:30:38 pm »

I'm trying on a local copy oc coppermine. Give me 10 minutes to put is on a test server online and I'll give you the link...
Logged
Shift Srl
 *Link Removed*

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #13 on: November 09, 2010, 01:53:29 pm »

Ok let's go. Here's the test gallery url

http://test.shift.it/cpg
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #14 on: November 09, 2010, 01:57:29 pm »

http://test.shift.it/cpg
I can see relative paths. Do you have the plugin installed (not just uploaded) on that test gallery?
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #15 on: November 09, 2010, 02:04:05 pm »

plugin api enabled and plugin installed as you can see from the attached screenshot

Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #16 on: November 09, 2010, 02:09:11 pm »

Please post the content of the codebase.php file.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #17 on: November 09, 2010, 02:14:59 pm »

Here it is

Code: [Select]
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_filter('picture_url', 'absolute_url_picture_url');

function absolute_url_picture_url($pic_row) {
    global $CONFIG;

    $pic_row['url'] = $CONFIG['http://www.shiftcdn.it/kog/'].$pic_row['url'];

    return $pic_row;
}

?>
Logged
Shift Srl
 *Link Removed*

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Moving the 'Album' directory on another server
« Reply #18 on: November 09, 2010, 02:18:42 pm »

Change
Code: [Select]
    $pic_row['url'] = $CONFIG['http://www.shiftcdn.it/kog/'].$pic_row['url'];to
Code: [Select]
    $pic_row['url'] = 'http://www.shiftcdn.it/kog/'.$pic_row['url'];
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Moving the 'Album' directory on another server
« Reply #19 on: November 09, 2010, 02:22:53 pm »

Wowowowowowow!!! It works!!!!

That way it's fantastic!Let me double check.

I upload all the images on ly local server
Insert them in CPG so that the normal and thumbs are created
I mirror the images folder just inserted in the CDN

That's all!

It's correct?
Logged
Shift Srl
 *Link Removed*
Pages: [1] 2   Go Up
 

Page created in 0.029 seconds with 21 queries.