pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

kohana private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Minus Creative on Mon 21 Jul 03:34
report abuse | download | new post

  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 (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.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me