[Done]: Enhance Pic Manager with thumbnails [Done]: Enhance Pic Manager with thumbnails
 

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]

Main Menu

[Done]: Enhance Pic Manager with thumbnails

Started by Gene-2008, August 23, 2009, 03:31:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gene-2008

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
$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:
$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
           if($get_pohoto_name == ''){
               $get_pohoto_name = $picture['filename'];    
           }


And add this after it:
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:

$lb .='<tr id=sort-'.$picture["pid"].' ><td class="dragHandle"></td><td width="96%">'.$get_pohoto_name.'</td></tr>';


And change it to this:

$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

Joachim Müller

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

Joachim Müller

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