【发布时间】:2020-05-03 12:31:37
【问题描述】:
我的代码:
<!DOCTYPE html>
<html>
<body>
<h1>Rotating an Image</h1>
<?php
$img = imagecreatefromjpeg("myPic.jpg");
$imgRotated = imagerotate($img, 45, -1);
imagejpeg($imgRotated, "myPic.jpg", 100);
?>
<img src="myPic.jpg"/><img src="myPicRotated.jpg">
</body>
</html>
错误
Warning: imagejpeg() expects parameter 1 to be resource, bool given in C:\xampp\htdocs\MyWebsite\index.php on line 11
【问题讨论】:
-
我很确定
-1不是imagerotate的第三个 (bgd_color) 参数的有效值... -
正如@Nick 已经说过的那样,
-1会导致问题。还有一个question on SO关于这个。 -
@codedge 感谢您指出这个骗局,我已经结束了这个问题。
标签: php runtime-error imagecreatefromjpg