forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 bridging => Topic started by: Putoguiri on October 25, 2012, 01:12:43 pm
-
Hey,
I coded a very simple workaround in order to display the last uploaded pictures to my gallery on the frontpage of my website.
First I created a simple .php which gathers the needed information (file location + pid). I called it "last.php":
<?php
Header('Content-Type: txt');
define('IN_COPPERMINE', true);
require('include/init.inc.php');
$pic_data = get_pic_data('lastup', $thumb_count, $album_name, -1, 1);
for ($i = 0; $i <=2; $i++){
$pic_url = get_pic_url($pic_data[$i], 'thumb');
echo $pic_url.';'.$pic_data[$i]['pid'].';';
}
?>
And on the frontpage I did a very simple php which gets the string, explodes it, displays the images and links them.
Works like a charm, the only problem is: last.php is very slow. If I call it directly it is slow and if I load the frontpage you can actually see it's waiting for last.php to finish.
What did I do wrong?
-
Oh, if you want to try the php:
http://www.museabuse.com/gallery/last.php
(Why can't I edit my post?)
-
You probably want to try the CPMFetch plugin, as it has been created for exactly such tasks. If not, I suggest to query the database directly instead of using Coppermine's functions.
-
Thanks!
But wasn't cpmfetch discontinued? At least it was last time I checked :-\
-
AFAIK it works with cpg1.5.x.
-
Replaced it with cpmfetch (Took me a long time to find it, since the website it was on is now offline, etc).
Works like a charm now :)