嘗試使用imagick處理上傳的圖像時出現以下錯誤。imagick錯誤:'無法打開圖像'圖像上傳
Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `9eK59iu.jpg': No such file or directory @ error/blob.c/OpenBlob/2644' in D:\PATH\upload.php on line 77
的代碼看起來是這樣的:
<?php
$new_folder_name = "D:/PATH/content";
mkdir("$new_folder_name",0700);
$tmp_img = $_FILES["upload_file"]["tmp_name"];
$img = new Imagick($tmp_img);
$img->thumbnailImage(100 , 100 , TRUE);
$img->writeImage($new_folder_name);
?>
沒有imagick圖片上傳的作品就好了。
只有imagick不會開放給$ _FILES
我也試圖與imagick打開圖像,move_uploaded_file
後的圖像,像這樣:
<?php
$extension = pathinfo($upload_file_name, PATHINFO_EXTENSION);
$new_upload_file_name = rand(00000, 99999).".".$extension;
$new_folder_name = "D:/PATH/content".time();
mkdir("$new_folder_name",0700);
$path_to_file = $new_folder_name."/".$new_upload_file_name;
move_uploaded_file($_FILES["upload_file"]["tmp_name"],$path_to_file);
$img = new Imagick($path_to_file);
$img->thumbnailImage(100 , 100 , TRUE);
$img->writeImage($new_folder_name);
?>
既不工程.. :-(
任何建議?
我改變了代碼就像你說的,現在我得到這個錯誤: >致命錯誤:未捕獲的異常「ImagickException」有消息「無法打開圖像'd:/ PATH /內容/ 1370182981':Permission denied @ error/blob.c/OpenBlob/2644'in D:\ PATH \ upload.php on line 84 – Rotareti
問題是我只在這裏放了一個路徑:'writeImage($ new_folder_name);'我忘了文件名。 – Rotareti