我有一個關於如何在移動文件時過濾圖片的問題。我使用uploadify上傳圖片。我所做的是,在將圖像移動到目錄之前,代碼過濾器會將圖像轉換爲灰度。PHP imagefilter和uploadify
這裏是我的代碼
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$newImg = imagefilter($tempFile, IMG_FILTER_GRAYSCALE); // This is what I insert
move_uploaded_file($newImg,$targetFile);
echo "1";
}
的代碼是uploadify.php,我只是插入一個過濾器,使其灰階。請幫幫我。提前致謝。
您的問題是什麼? – 2011-04-06 08:30:20
關於如何在將圖像移動到目錄之前將圖像製作成灰度圖 – Jorge 2011-04-06 08:32:01
'imagefilter()'適用於需要使用適當的'imagecreatefrom *()'函數首先初始化的圖像資源。有關示例,請參見[imagefilter']手冊(http://www.php.net/imagefilter)。 – 2011-04-06 08:39:01