Subdomain Posts
None | 22 min ago
None | 23 min ago
None | 1 hour ago
None | 3 hours ago
None | 6 hours ago
None | 6 hours ago
None | 7 hours ago
None | 10 hours ago
None | 13 hours ago
None | 19 hours ago
Recent Posts
JavaScript | 3 sec ago
XML | 1 min ago
CSS | 2 min ago
None | 2 min ago
None | 2 min ago
None | 2 min ago
REBOL | 3 min ago
None | 3 min ago
PHP | 4 min ago
None | 4 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Minus Creative on the 21st of Jul 2008 02:34:56 AM Download | Raw | Embed | Report
  1. /*
  2.  * A simple implementation for an 'EXIF' auto-rotate
  3.  * option in Image lib. Uses PHP's built-in EXIF
  4.  * reading capabilities. 'IFDO' is a small subset
  5.  * of the available EXIF data. It might be
  6.  * preferred to read all EXIF data instead, and
  7.  * then pass that information back to the user
  8.  * since it's already being read. Maybe they
  9.  * should be separated, and EXIF should be
  10.  * automagically called if 'EXIF' is passed
  11.  * to rotate.
  12.  *
  13.  * This is really simple and lacks basic checks, I know.
  14.  */
  15.  
  16. /*
  17.  * Read the EXIF
  18.  */
  19. $image->exif = exif_read_data($file->image_path, 'IFD0');
  20.  
  21.  
  22. /*
  23.  * Auto-rotate based on provided EXIF
  24.  */
  25. switch($image->exif['Orientation']) {
  26.        
  27.         case 1:
  28.                 break;
  29.        
  30.         case 2:
  31.                 $image->flip(5);
  32.                 break;
  33.                
  34.         case 3:
  35.                 $image->rotate(180);
  36.                 break;
  37.                
  38.         case 4:
  39.                 $image->flip(6);
  40.                 break;
  41.                
  42.         case 5:
  43.                 $image->rotate(90)->flip(6);
  44.                 break;
  45.                
  46.         case 6:
  47.                 $image->rotate(90);
  48.                 break;
  49.                
  50.         case 7:
  51.                 $image->rotate(90)->flip(5);
  52.                 break;
  53.                
  54.         case 8:
  55.                 $image->rotate(-90);
  56.                 break;
  57. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: