found this code for another script, and it adds a 1px black border all around thumbnail and also adds a small bar (15px high) at bottom of thumbnail with image size and dimentions:
the upload.php file has some code that reads:
PHP
// create thumbnails?
if ( $create_thumbs && is_image ( $dest_path, true ) )
{
$image_inf = getimagesize ( $dest_path );
$image_ratio = $image_inf[1] / $image_inf[0];
$new_width = $UPL['CONFIGS']['THUMBNAIL_WIDTH'];
$new_height= ceil ( $new_width * $image_ratio );
$thumb_name = get_filename ( $dest_path ) . '_thumb.' . get_extension ( $dest_path );
$thumb_created = true;
$thumb_url = $UPL['SETTINGS']['userfiles_url'] . $UPL['USER']['id'] . '/' . ( $upload_to != '' ? $upload_to . '/' : '' ) . rawurlencode ( basename ( $thumb_name ) );
/*
Check the filesize of the full sized image and send it to img_resize so it can
be added onto the thumbnail
By Chick3n
*/
$fsize = round(filesize($dest_path)/1024,0);
if ( img_resize ( $dest_path, $thumb_name, $new_width, $new_height, $fsize ) )
{
$space_used += filesize ( $thumb_name );
}
}
else
{
$thumb_created = false;
$thumb_url = '';
}
another file named 'functions.php' has some code that reads:
PHP
function img_resize ( $src, $dst, $width, $height, $fsize )
{
$img_inf = @getimagesize ( $src );
if ( is_array ( $img_inf ) )
{
$im_src = importimage ( $src, $img_inf[2] );
if ( $im_src === false ) return false;
/*
The following code makes the image 15pixels taller and adds a 1px border
around every edge. It then adds a black box to the bottom (15px high)
and adds text detailing the size of the image and its dimensions
Make sure you upload arial.ttf to the same folder as "upload.php"
(not the includes folder)
Thanks to MarcelG for pointing out some of my errors (and fixing one :))
By Chick3n
*/
$resheight = $height;
$height = $height+15;
$im_dst = ImageCreateTrueColor ( $width, $height );
ImageCopyResampled ( $im_dst, $im_src, 0, 0, 0, 0, $width, $resheight, $img_inf[0], $img_inf[1] );
$black = ImageColorAllocate($im_dst, 0, 0, 0);
imageline($im_dst,0,0,$width,0,$black); #top
imageline($im_dst,0,$height-1,$width,$height-1,$black); #bottom
imageline($im_dst,0,0,0,$height,$black); #left
imageline($im_dst,$width-1,0,$width-1,$height,$black); #right
$white = ImageColorAllocate($im_dst, 255, 255, 255);
imagefilledrectangle($im_dst,0,$height-15,$width-1,$height,$black);
$font = "arial.ttf";
$size = 9;
$string = $img_inf[0]."x".$img_inf[1]." ".$fsize."kb";
$bbox = imagettfbbox ($size, 0, $font, $string);
$textWidth = $bbox[2] - $bbox[0];
$hwidth = floor($width/2);
$textpos = $hwidth-ceil($textWidth/2);
imagettftext($im_dst,$size,0,$textpos,$height-3,$white,$font,$string);
/*
End custom code :)
*/
$retval = exportimage ( $im_dst, $img_inf[2], $dst );
imagedestroy ( $im_src );
imagedestroy ( $im_dst );
return $retval;
}
return false;
}
could that be helpful at all for the topic of this thread?