Moving the 'Album' directory on another server Moving the 'Album' directory on another server
 

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

Moving the 'Album' directory on another server

Started by shiftsrl, November 07, 2010, 09:21:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shiftsrl

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
Shift Srl
*Link Removed*

Αndré

Quote from: shiftsrl on November 07, 2010, 09:21:27 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.

shiftsrl

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?
Shift Srl
*Link Removed*

Αndré

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.

shiftsrl

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.
Shift Srl
*Link Removed*

Αndré


shiftsrl

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

Αndré

Lol. Just a small error in reasoning :D

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

Keep in mind that $pic_row['url'] can contain something like
albums/test2/test.jpg
(= files in your album directory) but also default thumbnails that resides in the images directory like
images/thumbs/thumb_pdf.png

So you'll have to mirror at least those 2 directories.

shiftsrl

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?
Shift Srl
*Link Removed*

Αndré


shiftsrl

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...
Shift Srl
*Link Removed*

Αndré

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.

shiftsrl

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...
Shift Srl
*Link Removed*

shiftsrl

Shift Srl
*Link Removed*

Αndré

Quote from: shiftsrl on November 09, 2010, 01:53: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?

shiftsrl

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

Shift Srl
*Link Removed*

Αndré

Please post the content of the codebase.php file.

shiftsrl

Here it is

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;
}

?>
Shift Srl
*Link Removed*

Αndré

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

shiftsrl

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?
Shift Srl
*Link Removed*