+ if ($ext == ".jpg") {
+ if (!empty($exif['Orientation'])) {
+ $orientation = $exif['Orientation'];
+ if ($orientation === 3) $newImg = imagerotate($newImg, 180, 0);
+ elseif ($orientation === 6) $newImg = imagerotate($newImg, -90, 0);
+ elseif ($orientation === 8) $newImg = imagerotate($newImg, 90, 0);
+ }
+ imagejpeg($newImg, $newImgFile, JPEG_QUALITY);
+ } else {