forum.coppermine-gallery.net

No Support => Feature requests => Scheduled for cpg1.5.x => Topic started by: Gene-2008 on August 23, 2009, 03:31:55 am

Title: [Done]: Enhance Pic Manager with thumbnails
Post by: Gene-2008 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
Title: Re: Enhance Pic Manager with thumbnails
Post by: Joachim Müller on August 23, 2009, 12:30:29 pm
Valid suggestion. I'll look into this to see if this can still be added.
Title: Re: Enhance Pic Manager with thumbnails
Post by: Joachim Müller 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".