<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("image", $con);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$result = mysql_query("SELECT * FROM image ORDER BY file_name DESC LIMIT 1");
$row = mysql_fetch_array($result);
$src = '"'.$row['file_name'].'"';
$targ_w = $targ_h = 300;
$jpeg_quality = 90;
$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/jpg');
imagejpeg($dst_r,null,$jpeg_quality);
exit;
}
?>
我能夠呼應到從數據庫中檢索的FILE_NAME,但我無法將文件附加在這個部分$img_r = imagecreatefromjpeg($src);
這是它會導致錯誤? 有什麼想法?無法附加文件名
運行此腳本時是否生成錯誤消息? – 2012-02-10 18:33:44