No Support > Scheduled for cpg1.5.x

[Done]: Enhance Pic Manager with thumbnails


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: ---$result = cpg_db_query("SELECT aid, pid, filename, title FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid ORDER BY position ASC, pid");

--- End code ---

And changed it to this:

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

--- End code ---

Find this

--- Code: ---            if($get_pohoto_name == ''){
                $get_pohoto_name = $picture['filename'];    

--- End code ---

And add this after it:

--- Code: --- 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'] ;

--- End code ---

Find this:

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

And change it to this:

--- Code: ---$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>';

--- End code ---

Attached is the result.

Hope you find this useful,

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


[0] Message Index

Go to full version