21,886
社区成员
发帖
与我相关
我的任务
分享
$targ_w = $targ_h = 150; //保存的图片的大小
$jpeg_quality = 90;
$src = '/image/abc.jpg';
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/jpeg');
imagejpeg($dst_r,null,$jpeg_quality);
ImageDestroy($dst_r);