<?php
$img = imagecreatefromjpeg('simpletext.jpg');
$imgRotated = imagerotate($img, 45,-1);
imagejpeg($imgRotated,'newsimpletext.jpg',100);
?>
<img src="simpletext.jpg" />
<hr>
<img sec="newsimpletext.jpg" />
我想以旋转版本输出图像,但它有错误
警告:imagejpeg()要求参数1为资源,第6行的C:\ xampp \ htdocs \ developphp \ index.php中给出布尔值
答案 0 :(得分:0)
路径中一定有错误, 测试此代码:
if(is_file('simpletext.jpg')){
$img = imagecreatefromjpeg('simpletext.jpg');
$imgRotated = imagerotate($img, 45,-1);
imagejpeg($imgRotated,'newsimpletext.jpg',100);
}
else echo "error on image file or path";
echo '<img src="simpletext.jpg" /><hr><img src="newsimpletext.jpg" />';
结果是: