創建縮略圖是我的代碼錯誤,而試圖用PHP
$img_dir ="C:\xampp\folders\img\*.jpg";
$thumb_width = 100;
// Open a known directory, and proceed to read its contents
$scan= glob($img_dir);
foreach($scan as $image) {
$im= imagecreatefromjpeg($image);
$img_width = imagesx($im);
$img_height=imagesy($im);
$thumb_height= floor ($img_height *($thumb_width/$img_width));
$new_img=imagecreatetruecolor($thumb_width,$thumb_height);
imagecopyresized($new_img, $im, 0,0, 0, 0, $thumb_width, $thumb_height, $img_width, $img_height);
$thumb_path = "C:\xampp\folders\thumbs\";
imagejpeg($new_img,$thumb_path);
}
我不斷收到此錯誤
Warning: imagejpeg(C:\xampp\folders\thumbs): failed to open stream: Permission denied in C:\xampp\folders\index.php on line 32
目標文件具有讀取和寫入權限!我的代碼有什麼問題
感謝它的工作! – fSazy
不客氣。 – 2014-01-15 10:44:55