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: [Solved]: Category Thumb Being Last Added Image  (Read 2988 times)

0 Members and 1 Guest are viewing this topic.

aunrea

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 36
    • Spot Design
[Solved]: Category Thumb Being Last Added Image
« on: May 02, 2008, 01:21:39 am »

Is there a way to have the category thumb be the last added image to that category, instead of a pre-selected image? I tried using cpmFetch to do it but I couldn't figure out how to get the category id.

I am using Coppermine 1.4.16 Modded by Stramm version.
My gallery is located at http://candaceduffyjones.com/gallery
« Last Edit: May 06, 2008, 11:04:40 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Category Thumb Being Last Added Image
« Reply #1 on: May 02, 2008, 02:08:42 pm »

Update your gallery. Then edit index.php. Find

Code: [Select]
                if ($subcat['thumb'] > 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$subcat['thumb']}'" . $pic_filter;

Change to

Code: [Select]
                if ($pic_count) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = a.aid AND approved='YES' AND category = {$subcat['cid']} " . $album_filter . " ORDER BY pid DESC LIMIT 1";
Logged

aunrea

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 36
    • Spot Design
Re: Category Thumb Being Last Added Image
« Reply #2 on: May 06, 2008, 10:51:52 pm »

That worked! Thanks!
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.