diff options
| author | czaks <marcin@6irc.net> | 2013-08-03 21:01:26 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-03 21:01:26 -0400 |
| commit | d79da75fa9f664d13cc99dc984b53c7b2a06fd5c (patch) | |
| tree | 061ce3c27fb92fe0f6327854c2394b6a83881e9c /post.php | |
| parent | a0855cdcf5634d64fbb1ba294b05c8365ce37338 (diff) | |
| parent | e59c404ac27b1fcf8ebdcc6c8369e53c50615073 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Diffstat (limited to 'post.php')
| -rw-r--r-- | post.php | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -449,22 +449,24 @@ if (isset($_POST['delete'])) { } - if ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg') { + 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'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg')))) { - if ($config['thumb_method'] == 'convert' || $config['thumb_method'] == 'convert+gifsicle') { + 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')); if (isset($exif['Orientation']) && $exif['Orientation'] != 1) { - shell_exec('convert ' . escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload)); + if($error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . + escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload))) + error('Could not auto-orient image!', null, $error); } } } } // create image object - $image = new Image($upload, $post['extension']); - + $image = new Image($upload, $post['extension'], $size); if ($image->size->width > $config['max_width'] || $image->size->height > $config['max_height']) { $image->delete(); error($config['error']['maxsize']); @@ -505,8 +507,13 @@ if (isset($_POST['delete'])) { } if ($config['redraw_image'] || ($config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) { - $image->to($post['file']); - $dont_copy_file = true; + if (!$config['redraw_image'] && $config['strip_with_exiftool']) { + if($error = shell_exec_error('exiftool -q -all= ' . escapeshellarg($upload))) + error('Could not strip EXIF metadata!', null, $error); + } else { + $image->to($post['file']); + $dont_copy_file = true; + } } $image->destroy(); } else { @@ -520,7 +527,7 @@ if (isset($_POST['delete'])) { } if (!isset($dont_copy_file) || !$dont_copy_file) { - if (!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) + if (!@move_uploaded_file($upload, $post['file'])) error($config['error']['nomove']); } } |
