Image getting rotated automatically on upload

前端 未结 3 1684
面向向阳花
面向向阳花 2020-12-09 18:32

I\'m trying to upload a base64 encoded image and save after decoding it. Image is getting uploaded and saved, and I can access it using a URL and everything..but the image g

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 19:01

    ";
        print_r($exif);
        echo "
    "; if (!empty($exif['Orientation'])) { $imageResource = imagecreatefromjpeg($filePath); switch ($exif['Orientation']) { case 3: $image = imagerotate($imageResource, 180, 0); break; case 6: $image = imagerotate($imageResource, -90, 0); break; case 8: $image = imagerotate($imageResource, 90, 0); break; default: $image = $imageResource; } imagejpeg($image, $filename, 90); } } ?>
    Choose img

提交回复
热议问题