summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-04 01:00:23 -0400
committerczaks <marcin@6irc.net>2013-08-04 01:00:23 -0400
commit7ed01737c7019bf101dc706197e9899514d4b7ec (patch)
treee9939e35c3209be87d8922802fd394b3447a7eff /post.php
parentf2427ca3920147b294f07f58aadcf95cb70447a9 (diff)
parenta2b432cfb08c75159f73e2112be600cb5c0a4ef1 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Diffstat (limited to 'post.php')
-rw-r--r--post.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/post.php b/post.php
index a6ed55e6..fa910939 100644
--- a/post.php
+++ b/post.php
@@ -452,7 +452,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'));
@@ -460,8 +460,19 @@ 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'] && !$config['strip_exif']) {
+ 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));
@@ -469,6 +480,8 @@ if (isset($_POST['delete'])) {
if ($error)
error('Could not auto-orient image!', null, $error);
$size = @getimagesize($upload);
+ if ($config['strip_exif'])
+ $post['exif_stripped'] = true;
}
}
}
@@ -515,8 +528,8 @@ if (isset($_POST['delete'])) {
$thumb->_destroy();
}
- 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'] || (!@$post['exif_stripped'] && $config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) {
+ 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 {