public static function rotate($path, $rotate = null)
    {
        if ($rotate === null) {
            $exif = exif_read_data($path);
            switch ($exif["Orientation"]) {
                case 3:
                    $rotate = 180;
                    break;
                case 6:
                    $rotate = 90;
                    break;
                case 8:
                    $rotate = -90;
                    break;
            }
        }
        if (!$rotate) {
            return;
        }

        $format = getimagesize($path)[2];

        $image = static::create($path, $format);

        $rotate = imagerotate($image, $rotate * -1, 0);

        static::save($rotate, $path, $format);
    }