Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Show last uploaded pictures from any location. Needs optimization.  (Read 5861 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: 15764
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: 15764
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.019 seconds with 19 queries.