public function generateRotateAuto(GD $gd)
 {
     $exif = $this->Exif();
     if (!$exif) {
         return;
     }
     $imagePath = $this->owner->getFullPath();
     $imageFileExt = strtolower(File::get_file_extension($imagePath));
     if (!in_array($imageFileExt, array('jpeg', 'jpg'))) {
         return;
     }
     $orientation = $this->getExifOrientation();
     if (!$orientation) {
         return;
     }
     switch ($orientation) {
         case 3:
             // image upside down
             return $gd->rotate(180);
         case 6:
             // 90 rotate right & switch max sizes
             return $gd->rotate(-90);
         case 8:
             // 90 rotate left & switch max sizes
             return $gd->rotate(90);
     }
     return false;
 }
 public function generateRotateCounterClockwise(GD $gd)
 {
     return $gd->rotate(270);
 }
 public function generateRotatedImage(GD $gd, $angle)
 {
     return $gd->rotate($angle);
 }