I wrote this short function which I trigger from an email link which notifies me whenever a new photo has been uploaded to my server:
$fotofil = $_GET['fotofil'];
$image = imagecreatefromjpeg("media/$fotofil");
$image = imagerotate($image, 270, 0);
imagejpeg($image, "media/$fotofil");
echo "The photo has been rotated:<br />";
echo "<img src='media/$fotofil' style='max-height:90vh;' />";
The function rotates the image 90 degrees clockwise and saves it with the original filename. For some reason, this only works once. If I trigger the same link once more, it keeps the rotation from the first time it was triggered. Why?