imagerotate()函数有时工作,有时不工作

时间:2015-08-07 06:10:22

标签: php image rotation

有时 imagerotate() PHP函数不起作用(没有错误,图像根本就没有旋转),有时它可以工作。这让我很疯狂。

这是我的代码:

if ($degrees == 90)
    $degrees = 270;
elseif ($degrees == 270)
    $degrees = 90;

// Chargement
$source = imagecreatefromjpeg($filename);

// Rotation
$rotate = imagerotate($source, $degrees, 0);

imagejpeg($rotate, $filename, 95);

// Libération de la mémoire
imagedestroy($source);
imagedestroy($rotate);

在我设置的htaccess中:

ExpiresActive Off

#ExpiresByType image/jpg "access plus 1 hour"
#ExpiresByType image/jpeg "access plus 1 hour"
#ExpiresByType image/png "access plus 1 hour"

所以通常没有缓存。

请帮忙。

1 个答案:

答案 0 :(得分:0)

我得到了错误:照片是在弹出窗口中重新加载母窗口。问题是母窗口刚刚上传了照片,因此重新上传的原始照片覆盖了旋转的照片。

相关问题