Generate thumbnails
$tx=GetImageSize($sample);
if($tx[0]<=$tx[1] and $tx[1]>=120){
$height=120;
$width=intval($height*$tx[0]/$tx[1]);
}
if($tx[0]>=$tx[1] and $tx[0]> ;=100){
$width=100;
$height=intval($width*$tx[1]/$tx[0]);
}
if($tx[0 ]<100 and $tx[1]<120){
$width=$tx[0];
$height=$tx[1];
}
makethumb2 ($sample,$target,$width,$height);
// $srcFile: Source file
// $dstFile: Target file
// $dstW: Target image width
// $dstH: target file height
function makethumb2($srcFile,$dstFile,$dstW,$dstH){
$data=GetImageSize($srcFile,&$info);
switch($ data[2]){
case 1:
$im=@ImageCreateFromGIF($srcFile);
break;
case 2:
🎜> ImageSY($im);
$ni=ImageCreate($dstW,$dstH); srcH);
ImageJpeg($ni,$dstFile); ’ ’ s ’ ’ ‐ ‐ ‐ ‐ ‐ ‐ ‐ , just change the last sentence
}
http://www.bkjia.com/PHPjc/314377.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/314377.html
TechArticle