Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Show last uploaded pictures from any location. Needs optimization.  (Read 5362 times)

0 Members and 1 Guest are viewing this topic.

Putoguiri

  • Coppermine newbie
  • Offline Offline
  • Posts: 5

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

Code: [Select]
<?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?
Logged

Putoguiri

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Show last uploaded pictures from any location. Needs optimization.
« Reply #1 on: October 25, 2012, 01:15:15 pm »

Oh, if you want to try the php:

http://www.museabuse.com/gallery/last.php

(Why can't I edit my post?)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Show last uploaded pictures from any location. Needs optimization.
« Reply #2 on: October 25, 2012, 02:21:11 pm »

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.
Logged

Putoguiri

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Show last uploaded pictures from any location. Needs optimization.
« Reply #3 on: October 25, 2012, 02:27:53 pm »

Thanks!

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Show last uploaded pictures from any location. Needs optimization.
« Reply #4 on: October 25, 2012, 02:36:20 pm »

AFAIK it works with cpg1.5.x.
Logged

Putoguiri

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Show last uploaded pictures from any location. Needs optimization.
« Reply #5 on: October 25, 2012, 05:14:25 pm »

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  :)
Logged
Pages: [1]   Go Up
 

Page created in 0.052 seconds with 19 queries.