imagerotate() function sometimes work and sometimes not

Sometimes imagerotate() PHP function doesn’t work (no error, the image is simply not rotated), sometimes it works. It makes me crazy.

Here’s my code:

[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);[/php]

In the htaccess I set:

[code]ExpiresActive Off

#ExpiresByType image/jpg “access plus 1 hour”
#ExpiresByType image/jpeg “access plus 1 hour”
#ExpiresByType image/png “access plus 1 hour”
so normally there is no cache.[/code]

Please help.

I got the bug : the photo was in a popup which reloads the mother window. The problem was that the mother window has just uploaded the photo, so the rotated photo was overwritten by the original photo re-uploaded.

Sponsor our Newsletter | Privacy Policy | Terms of Service