我嘗試調整圖像大小,但我仍然得到同樣的錯誤:(PHP)圖像的大小調整失敗:/
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 18
Warning: imagecreatefromjpeg(): 'img/test/Bildschirmfoto 2014-01-25 um 08.05.13 nachm Kopie.jpg' is not a valid JPEG file in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 18
Warning: imagesx() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 19
Warning: imagesy() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 20
Notice: A non well formed numeric value encountered in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 24
Notice: A non well formed numeric value encountered in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 24
Warning: imagesx() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 25
Warning: imagesy() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 25
Warning: imagecopyresized() expects parameter 2 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/dad/gallery.php on line 25
所以,這裏是我的代碼:
function make_thumb($image_path, $thumb_path, $thumb_width) {
$src_img = imagecreatefromjpeg("$image_path");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$new_h=$new_w;
$dst_img = imagecreatetruecolor($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$thumb_path");
RETURN TRUE;
}
這裏是圖片:
_'img /測試/ Bildschirmfoto 2014年1月25日嗯13年5月8日nachm Kopie。 jpg'不是有效的JPEG文件_ < - 就是這樣。 – Federkun
哦,那麼......它是什麼呢? – wEisB0145