Make WordPress Core

Ticket #14459: 14459.imagemagick.patch

File 14459.imagemagick.patch, 1.3 KB (added by dhuyvetter, 8 years ago)

Imagemagick version of 14459.patch

  • wp-includes/class-wp-image-editor-imagick.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    175175                        return $updated_size;
    176176                }
    177177
    178                 return $this->set_quality();
     178        $exif = exif_read_data($this->file);
     179        if($exif) {
     180            $orientation = 0;
     181
     182            if(!$orientation && isset($exif["Orientation"]))
     183                $orientation = $exif["Orientation"];
     184
     185            if(!$orientation && isset($exif["IFD0"]) && isset($exif["IFD0"]["Orientation"]))
     186                $orientation = $exif["IFD0"]["Orientation"];
     187
     188            if(!$orientation && isset($exif["COMPUTED"]) && isset($exif["COMPUTED"]["Orientation"]))
     189                $orientation = $exif["COMPUTED"]["Orientation"];
     190
     191
     192            switch($orientation) {
     193                case 3:
     194                    $this->rotate(180);
     195                    break;
     196                case 6:
     197                    $this->rotate(-90);
     198                    break;
     199                case 8:
     200                    $this->rotate(90);
     201                    break;
     202            }
     203        }
     204
     205        return $this->set_quality();
    179206        }
    180207
    181208        /**