<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吧?
报错信息已经说了参数不合法
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号