<code><?php move_uploaded_file($_FILES['upload']['tmp_name'],'x1.jpg'); $img='x1.jpg'; $thumbs=imagecreatetruecolor(500,500); $imgs=getimagesize($img); $width=500; $height=500; imagecopyresized($thumbs,$img,0,0,0,0,$width,$height,$img[0],$img[1]); imagejpeg($thumbs,'xxxx.jpg'); ?></code>
最後保存出來的圖像是黑色的。大小正常,就是一片漆黑,是什麼原因呢?謝謝
而且,提示:Warning: imagecopyresized() expects parameter 2 to be resource, string given in F:phpstudyWWWreceive.php on line 10,哪裡出問題了?
<code><?php move_uploaded_file($_FILES['upload']['tmp_name'],'x1.jpg'); $img='x1.jpg'; $thumbs=imagecreatetruecolor(500,500); $imgs=getimagesize($img); $width=500; $height=500; imagecopyresized($thumbs,$img,0,0,0,0,$width,$height,$img[0],$img[1]); imagejpeg($thumbs,'xxxx.jpg'); ?></code>
最後保存出來的圖像是黑色的。大小正常,就是一片漆黑,是什麼原因呢?謝謝
而且,提示:Warning: imagecopyresized() expects parameter 2 to be resource, string given in F:phpstudyWWWreceive.php on line 10,哪裡出問題了?
應該是要先建立一個圖片,然後傳給函數,然後再儲存為img吧?
報錯資訊已經說了參數不合法