public static function createFromFile( $imageFile ) {
        if ( ! file_exists( $imageFile ) ) {
            throw new \Exception( sprintf( 'Could not open "%s". File does not exist.', $imageFile ) );
        }

        $type = self::_guessType( $imageFile );
        if ( ImageType::GIF == $type ) {

            return self::_createGif( $imageFile );

        } else if ( ImageType::JPEG == $type ) {

            return self::_createJpeg( $imageFile );

        } else if ( ImageType::PNG == $type ) {

            return self::_createPng( $imageFile );

        } else if ( ImageType::WBMP == $type ) {

            return self::_createWbmp( $imageFile );

        } else {
            throw new \Exception( sprintf( 'Could not open "%s". File type not supported.', $imageFile ) );
        }
    }
public static function createFromFile( $imageFile ) {
        if ( ! file_exists( $imageFile ) ) {
            throw new \Exception( sprintf( 'Could not open "%s". File does not exist.', $imageFile ) );
        }

        $type = self::_guessType( $imageFile );
        if ( ImageType::GIF == $type ) {

            return self::_createGif( $imageFile );

        } else if ( ImageType::JPEG == $type ) {

            return self::_createJpeg( $imageFile );

        } else if ( ImageType::PNG == $type ) {

            return self::_createPng( $imageFile );

        } else if ( ImageType::WBMP == $type ) {

            return self::_createWbmp( $imageFile );

        } else {
            throw new \Exception( sprintf( 'Could not open "%s". File type not supported.', $imageFile ) );
        }
    }
public static function createFromFile ( $ imageFile ) { if ( ! file_exists ( $ imageFile ) ) { throw new \ Exception ( sprintf ( 'Could not open "%s". File does not exist.' , $ imageFile ) ) ; } $ type = self :: _guessType ( $ imageFile ) ; if ( ImageType :: GIF == $ type ) { return self :: _createGif ( $ imageFile ) ; } else if ( ImageType :: JPEG == $ type ) { return self :: _createJpeg ( $ imageFile ) ; } else if ( ImageType :: PNG == $ type ) { return self :: _createPng ( $ imageFile ) ; } else if ( ImageType :: WBMP == $ type ) { return self :: _createWbmp ( $ imageFile ) ; } else { throw new \ Exception ( sprintf ( 'Could not open "%s". File type not supported.' , $ imageFile ) ) ; } }
Create Image from image file.

@param string $imageFile Path to image.

@return Image
@throws \Exception
Create Image from image file .