我正在使用jcrop來製作圖像作物。
但由此產生的croped圖像不能保存,我的意思是當我點擊右鍵並保存圖像時,它會保存.php文件。
下面是使用的代碼:爲什麼圖像標題不讓我保存圖像?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$targ_iw = $_REQUEST['iwidth'];
$targ_ih = $_REQUEST['iheight'];
$source = $_REQUEST['tname'];
if(empty($targ_iw)){
$targ_iw = $_POST['w'];
$targ_ih = $_POST['h'];
}
$jpeg_quality = 90;
$src = 'http://www.imageopti.com/crop/files/'.$source;
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor($targ_iw, $targ_ih);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
$targ_iw,$targ_ih,$_POST['w'],$_POST['h']);
header('Content-type: image/jpeg');
imagejpeg($dst_r, null, $jpeg_quality);
exit;
}
,什麼是PHP文件裏? – zerkms 2013-02-23 21:34:49
上面提到的頂級php代碼,下面是發送數據到這個部分創建作物的html/jquery表單。 – 2013-02-23 21:35:58
不,我的意思是 - 你有沒有試圖打開保存的PHP文件? – zerkms 2013-02-23 21:39:11