forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: 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. 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
-
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.
-
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?
-
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.
-
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.
-
Please install that (http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/absolute_url/?view=tar) plugin (http://documentation.coppermine-gallery.net/en/plugins.htm#plugin_manager) and report if it works.
-
Wow thanks!!! How can I configure it? Where can I insert the url of the images?
-
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.
-
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?
-
Please post a link to your gallery.
-
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...
-
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.
-
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...
-
Ok let's go. Here's the test gallery url
http://test.shift.it/cpg
-
http://test.shift.it/cpg
I can see relative paths. Do you have the plugin installed (not just uploaded) on that test gallery?
-
plugin api enabled and plugin installed as you can see from the attached screenshot
-
Please post the content of the codebase.php file.
-
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;
}
?>
-
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'];
-
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?
-
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 correct. In an ideal world Coppermine would transfer that files directly to your CDN, but that's more coding effort. Maybe someone extends that plugin with a configuration interface (to enter the CDN http address and ftp data or however you can transfer data to your CDN) and the needed backend code to transfer the files.
-
The other interesting thing is that doing so I've a copy of all my images locally and another copy mirrored so I've a sort of backup... :)
-
I forgot to thank you very very much for this plugin. Maybe You'll have to publish it since I think would be very interesting also for other members that has the same problem...
-
Maybe You'll have to publish it since I think would be very interesting also for other members that has the same problem...
Will do soon :)
-
I just updated the plugin at the svn repository (http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/absolute_url/?view=tar). It now has a config screen where you can easily enter your CDN's url. If you verify that it still works for you I'll release an official package.
-
As soon as I've clicked apply changes after inputting the url I've got this error
-
Please try again by replacing the admin.php file with the latest version (revision 8026).
-
Perfect. Now it work!
-
Just published the plugin here (http://forum.coppermine-gallery.net/index.php/topic,67980.0.html). I recommend to upgrade to that version, as it checks if the picture resides in the albums/ or images/ directory. So you don't have to sync the images/ directory anymore.
Please post all support requests regarding the plugin to the plugin announcement thread (http://forum.coppermine-gallery.net/index.php/topic,67980.0.html). Thanks.