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: [Done]: Enhance Pic Manager with thumbnails  (Read 10122 times)

0 Members and 1 Guest are viewing this topic.

Gene-2008

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 188
[Done]: Enhance Pic Manager with thumbnails
« on: August 23, 2009, 03:31:55 am »

Don't know whether to post this here, but here goes.

I'd like to suggest adding thumbnails to the sort pictures.

I changed picmgr.php in the following ways:
Find this
Code: [Select]
$result = cpg_db_query("SELECT aid, pid, filename, title FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid ORDER BY position ASC, pid");

And changed it to this:
Code: [Select]
$result = cpg_db_query("SELECT aid, pid, filepath, filename, title, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid ORDER BY position ASC, pid");

Find this
Code: [Select]
           if($get_pohoto_name == ''){
                $get_pohoto_name = $picture['filename'];    
            }

And add this after it:
Code: [Select]
if ($picture['pheight'] < $picture['pwidth'] ) { //landscape
$thb_width = $CONFIG['thumb_width'] ;
$thb_height = round($CONFIG['thumb_height'] * $picture['pheight'] / $picture['pwidth']);
} else {
$thb_width = round($CONFIG['thumb_width'] * $picture['pwidth'] / $picture['pheight']);
$thb_height = $CONFIG['thumb_height'] ;
}

Find this:
Code: [Select]
$lb .='<tr id=sort-'.$picture["pid"].' ><td class="dragHandle"></td><td width="96%">'.$get_pohoto_name.'</td></tr>';
And change it to this:
Code: [Select]
$lb .='<tr id=sort-'.$picture["pid"].' ><td class="dragHandle"></td><td width="96%">'.$get_pohoto_name.'&nbsp;&nbsp;&nbsp;&nbsp;'
             .'<img src="albums/'.$picture['filepath'].$CONFIG['thumb_pfx'].$get_pohoto_name
                .'" class="image" width="'.$thb_width
             .'" height="'.$thb_height
             .'" border="0" alt="'.$get_pohoto_name
             .'" /></td></tr>';

Attached is the result.

Hope you find this useful,
Gene
« Last Edit: August 23, 2009, 01:44:05 pm by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Enhance Pic Manager with thumbnails
« Reply #1 on: August 23, 2009, 12:30:29 pm »

Valid suggestion. I'll look into this to see if this can still be added.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Enhance Pic Manager with thumbnails
« Reply #2 on: August 23, 2009, 01:43:52 pm »

OK, this is in fact a bit more tricky than I originally anticipated, as you have to catter for non-images as well, but I came up with some code to accomplish this suggestion, went into rev6512. Marking as "done".
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.