首页 > imagecopyresized()压缩保存的图像是黑色的

imagecopyresized()压缩保存的图像是黑色的

<?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');
?>

最后保存出的图像是黑色的。大小正常,就是一片漆黑,是什么原因呢?谢谢

而且,提示:Warning: imagecopyresized() expects parameter 2 to be resource, string given in F:phpstudyWWWreceive.php on line 10,哪里出问题了?


应该是要先构建一个图片,然后传给函数,然后保存为img吧?
报错信息已经说了参数不合法

【热门文章】
【热门文章】