public function fixImage($path, ImageInterface $image)
    {
        // @codeCoverageIgnoreStart
        if ( ! function_exists('exif_read_data')) {
            return $image;
        }
        // @codeCoverageIgnoreEnd

        try {
            $exif = exif_read_data($path);
            // @codeCoverageIgnoreStart
        } catch (ErrorException $e) {
            if ($this->quiet) {
                return $image;
            }
            throw $e;
            // @codeCoverageIgnoreEnd
        }

        if ( ! isset($exif['Orientation']) || $exif['Orientation'] == static::ORIENTATION_TOPLEFT) {
            return $image;
        }

        switch ($exif['Orientation']) {

            case static::ORIENTATION_TOPRIGHT:
                $image->flipHorizontally();
                break;

            case static::ORIENTATION_BOTTOMRIGHT:
                $image->rotate(180);
                break;

            case static::ORIENTATION_BOTTOMLEFT:
                $image->flipVertically();
                break;

            case static::ORIENTATION_LEFTTOP:
                $image->flipVertically()->rotate(90);
                break;

            case static::ORIENTATION_RIGHTTOP:
                $image->rotate(90);
                break;

            case static::ORIENTATION_RIGHTBOTTOM:
                $image->flipHorizontally()->rotate(90);
                break;

            case static::ORIENTATION_LEFTBOTTOM:
                $image->rotate(-90);
                break;
        }

        return $image->strip();
    }