summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-04 00:48:28 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-04 00:48:28 -0400
commit0387ae1b46c62bc977172fd1c35f9684461e73d6 (patch)
treeada3cbc3c264dbc8f2c9a0fc9d70adc405f3ca3e /post.php
parent3d2de07a1f385dea5e15f2a9d05c42e0b8d9ba87 (diff)
Use exiftool to patch bug for now.
Diffstat (limited to 'post.php')
-rw-r--r--post.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/post.php b/post.php
index c355eca6..b159361a 100644
--- a/post.php
+++ b/post.php
@@ -450,7 +450,7 @@ if (isset($_POST['delete'])) {
if ($config['convert_auto_orient'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg')) {
// The following code corrects the image orientation.
// Currently only works with the 'convert' option selected but it could easily be expanded to work with the rest if you can be bothered.
- if (!($config['redraw_image'] || (($config['strip_exif'] && !$config['strip_with_exiftool']) && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg')))) {
+ if (!($config['redraw_image'] || (($config['strip_exif'] && !$config['use_exiftool']) && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg')))) {
if (in_array($config['thumb_method'], array('convert', 'convert+gifsicle', 'gm', 'gm+gifsicle'))) {
$exif = exif_read_data($upload);
$gm = in_array($config['thumb_method'], array('gm', 'gm+gifsicle'));
@@ -458,8 +458,17 @@ if (isset($_POST['delete'])) {
if ($config['convert_manual_orient']) {
$error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($upload) . ' ' .
- ImageConvert::jpeg_exif_orientation(false, $exif) . ' +profile "*" ' .
+ ImageConvert::jpeg_exif_orientation(false, $exif) . ' ' .
+ ($config['strip_exif'] ? '+profile "*"' : ($config['use_exiftool'] ? '' : '+profile "*"')) . ' ' .
escapeshellarg($upload));
+ if ($config['use_exiftool']) {
+ if ($exiftool_error = shell_exec_error(
+ 'exiftool -q -orientation=1 -n ' . escapeshellarg($upload)))
+ error('exiftool failed!', null, $exiftool_error);
+ } else {
+ // TODO: Find another way to remove the Orientation tag from the EXIF profile
+ // without needing `exiftool`.
+ }
} else {
$error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload));
@@ -514,7 +523,7 @@ if (isset($_POST['delete'])) {
}
if ($config['redraw_image'] || ($config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) {
- if (!$config['redraw_image'] && $config['strip_with_exiftool']) {
+ if (!$config['redraw_image'] && $config['use_exiftool']) {
if($error = shell_exec_error('exiftool -q -all= ' . escapeshellarg($upload)))
error('Could not strip EXIF metadata!', null, $error);
} else {