summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-07-19 09:39:22 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-07-19 09:39:46 -0400
commit0ba40a8fc2b7e798bf1b93e4f9c2972d3ba3f4cc (patch)
treee272d271283a57ba065a052079afedfad9b88f96
parent19766c4e0e9238be1cd7b2610500257e7aea6137 (diff)
I just realized that ImageMagick had a -auto-orient switch. No need for all that code.
-rw-r--r--post.php68
1 files changed, 2 insertions, 66 deletions
diff --git a/post.php b/post.php
index 97fb263d..30db27b9 100644
--- a/post.php
+++ b/post.php
@@ -434,72 +434,8 @@ if (isset($_POST['delete'])) {
if ($config['thumb_method'] == 'convert') {
if ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg') {
$exif = exif_read_data($upload);
- if (isset($exif['Orientation'])) {
- switch($exif['Orientation']) {
- case 1:
- // Normal
- $args = false;
- break;
- case 2:
- // 888888
- // 88
- // 8888
- // 88
- // 88
-
- $args = '-flop';
- break;
- case 3:
-
- // 88
- // 88
- // 8888
- // 88
- // 888888
-
- $args = '-flip -flop';
- break;
- case 4:
- // 88
- // 88
- // 8888
- // 88
- // 888888
-
- $args = '-flip';
- break;
- case 5:
- // 8888888888
- // 88 88
- // 88
-
- $args = '-rotate 90 -flop';
- break;
- case 6:
- // 88
- // 88 88
- // 8888888888
-
- $args = '-rotate 90';
- break;
- case 7:
- // 88
- // 88 88
- // 8888888888
-
- $args = '-rotate "-90" -flop';
- break;
- case 8:
- // 8888888888
- // 88 88
- // 88
-
- $args = '-rotate "-90"';
- break;
- }
-
- if ($args)
- shell_exec('convert ' . escapeshellarg($upload) . ' ' . $args . ' ' . escapeshellarg($upload));
+ if (isset($exif['Orientation']) && $exif['Orientation'] != 1) {
+ shell_exec('convert ' . escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload));
}
}
}