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

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

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