Thumbnail ..만들기..
썸네일 크기 정하고 같은 비율로 만들되.. 가로 세로 틀릴경우 검은 공백으로 메꾸기...
if(strtolower($_ext) == ".jpg"){//확장자가 jpg일때..
$imgSize=getimagesize($path.$_uploadName.$_ext);
if($imgSize[2] == 2 && ($imgSize[0]>220 || $imgSize[1]>220)){ //////////making thumbnail only jpg
///thumbnail size..
$bi = ($imgSize[0] > $imgSize[1]) ? round(220 / $imgSize[0],2) : round(220 / $imgSize[1],2);
$width = $imgSize[0]*$bi;
$height = $imgSize[1]*$bi;
///thumbnail blank size..
if($width > $height){
$h = 0; ///horizen
$v = (220-$height)/2; //virtical
}else{
$h = (220-$width)/2;
$v = 0;
}
$src = ImageCreateFromJPEG($path.$_uploadName.$_ext); //원본 데이타 경로및 화일명
$thumb = imagecreatetruecolor(220,220); //배경.
ImageCopyResized($thumb,$src,$h,$v,0,0,$width,$height,$imgSize[0],$imgSize[1]); ////이부분이 실제 그림..
ImageJPEG($thumb,$path.$_uploadName."_thumb".$_ext,100); // 저장될 경로및 화일명
imagedestroy($dest);
}//////////making thumbnail end
}