【发布时间】:2014-09-08 20:34:19
【问题描述】:
如果我尝试从现有的 .jpeg 图像创建新图像,则会给出黑色(空白)图像。
我的代码:
$new_path = 'post/'.time().'-myimage.jpeg';
$src="post/myimage.jpeg";
$jpeg_quality = 90;
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor($my_post['w'], $my_post['h']);
imagecopyresampled($dst_r,$img_r,0,0,$my_post['x'],$my_post['y'],$my_post['w'],$my_post['h'],$my_post['w'],$my_post['h']);
header('Content-Type: image/jpeg');
imagejpeg($dst_r, $new_path, $jpeg_quality);
【问题讨论】: