Show last uploaded pictures from any location. Needs optimization. Show last uploaded pictures from any location. Needs optimization.
 

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]

Main Menu

Show last uploaded pictures from any location. Needs optimization.

Started by Putoguiri, October 25, 2012, 01:12:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Putoguiri

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, -11);
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?

Putoguiri


Αndré

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.

Putoguiri

Thanks!

But wasn't cpmfetch discontinued? At least it was last time I checked  :-\

Αndré


Putoguiri

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  :)