Posted by Minus Creative on Mon 21 Jul 03:34
report abuse | download | new post
- /*
- * A simple implementation for an 'EXIF' auto-rotate
- * option in Image lib. Uses PHP's built-in EXIF
- * reading capabilities. 'IFDO' is a small subset
- * of the available EXIF data. It might be
- * preferred to read all EXIF data instead, and
- * then pass that information back to the user
- * since it's already being read. Maybe they
- * should be separated, and EXIF should be
- * automagically called if 'EXIF' is passed
- * to rotate.
- *
- * This is really simple and lacks basic checks, I know.
- */
- /*
- * Read the EXIF
- */
- /*
- * Auto-rotate based on provided EXIF
- */
- switch($image->exif['Orientation']) {
- case 1:
- break;
- case 2:
- $image->flip(5);
- break;
- case 3:
- $image->rotate(180);
- break;
- case 4:
- $image->flip(6);
- break;
- case 5:
- $image->rotate(90)->flip(6);
- break;
- case 6:
- $image->rotate(90);
- break;
- case 7:
- $image->rotate(90)->flip(5);
- break;
- case 8:
- $image->rotate(-90);
- break;
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.