imagerotate()不起作用 [英] imagerotate() doesn't work

查看:213
本文介绍了imagerotate()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对imagerotate()PHP函数有问题.我在下面运行脚本,它使用imagejpeg()成功创建了新图像,但是新图像与原始图像相同,因此不会旋转它. 它在Apache error.log中没有显示错误消息,所以我不知道.

i have a problem with the imagerotate() PHP function. I run the script below, and it successfully creates the new image with imagejpeg(), but the new image is the same as the original, so it doesn't rotate it. It shows no error message in the Apache error.log, so i have no idea.

$ file包含以下格式的文件名:IMG_8841.JPG

$file contains a filename in this form: IMG_8841.JPG

希望您能帮助我,谢谢.

I hope you can help me, thanks.

$filename='./original/'.$file;
$new='./rotated/'.$file;
$original_photo = imagecreatefromjpeg($filename);
imagerotate ($original_photo , 90 , 0 );
imagejpeg($original_photo, $new);
imagedestroy($original_photo);

推荐答案

尝试

$original_photo = imagerotate($original_photo, 90, 0);

否则您的对象不会被修改.

Else your object is not modified.

还是更好的事情:

$new_photo = imagerotate ($original_photo , 90 , 0 );
imagejpeg($new_photo, $new); 
imagedestroy($original_photo);
imagedestroy($new_photo);

这篇关于imagerotate()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆