CImage.php
public function rotateExif()
    {
        if (!in_array($this->fileType, array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM))) {
            $this->log("Autorotate ignored, EXIF not supported by this filetype.");
            return $this;
        }

        $exif = exif_read_data($this->pathToImage);

        if (!empty($exif['Orientation'])) {
            switch ($exif['Orientation']) {
                case 3:
                    $this->log("Autorotate 180.");
                    $this->rotate(180, $this->bgColor);
                    break;

                case 6:
                    $this->log("Autorotate -90.");
                    $this->rotate(-90, $this->bgColor);
                    break;

                case 8:
                    $this->log("Autorotate 90.");
                    $this->rotate(90, $this->bgColor);
                    break;

                default:
                    $this->log("Autorotate ignored, unknown value as orientation.");
            }
        } else {
            $this->log("Autorotate ignored, no orientation in EXIF.");
        }

        return $this;
    }
public function rotateExif()
    {
        if (!in_array($this->fileType, array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM))) {
            $this->log("Autorotate ignored, EXIF not supported by this filetype.");
            return $this;
        }

        $exif = exif_read_data($this->pathToImage);

        if (!empty($exif['Orientation'])) {
            switch ($exif['Orientation']) {
                case 3:
                    $this->log("Autorotate 180.");
                    $this->rotate(180, $this->bgColor);
                    break;

                case 6:
                    $this->log("Autorotate -90.");
                    $this->rotate(-90, $this->bgColor);
                    break;

                case 8:
                    $this->log("Autorotate 90.");
                    $this->rotate(90, $this->bgColor);
                    break;

                default:
                    $this->log("Autorotate ignored, unknown value as orientation.");
            }
        } else {
            $this->log("Autorotate ignored, no orientation in EXIF.");
        }

        return $this;
    }
public function rotateExif ( ) { if ( ! in_array ( $ this -> fileType , array ( IMAGETYPE_JPEG , IMAGETYPE_TIFF_II , IMAGETYPE_TIFF_MM ) ) ) { $ this -> log ( "Autorotate ignored, EXIF not supported by this filetype." ) ; return $ this ; } $ exif = exif_read_data ( $ this -> pathToImage ) ; if ( ! empty ( $ exif [ 'Orientation' ] ) ) { switch ( $ exif [ 'Orientation' ] ) { case 3 : $ this -> log ( "Autorotate 180." ) ; $ this -> rotate ( 180 , $ this -> bgColor ) ; break ; case 6 : $ this -> log ( "Autorotate -90." ) ; $ this -> rotate ( - 90 , $ this -> bgColor ) ; break ; case 8 : $ this -> log ( "Autorotate 90." ) ; $ this -> rotate ( 90 , $ this -> bgColor ) ; break ; default : $ this -> log ( "Autorotate ignored, unknown value as orientation." ) ; } } else { $ this -> log ( "Autorotate ignored, no orientation in EXIF." ) ; } return $ this ; }
Rotate image using information in EXIF.

@return $this
Rotate image using information in EXIF .