1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Use exiftool to patch bug for now.

This commit is contained in:
Michael Foster 2013-08-04 00:48:28 -04:00
parent 3d2de07a1f
commit 0387ae1b46
2 changed files with 15 additions and 5 deletions

View File

@ -509,8 +509,9 @@
// Strip EXIF metadata from JPEG files.
$config['strip_exif'] = false;
// Use the command-line `exiftool` tool to strip EXIF metadata without decompressing/recompressing JPEGs.
// Ignored when $config['redraw_image'] is true.
$config['strip_with_exiftool'] = false;
// Ignored when $config['redraw_image'] is true. This is also used to adjust the Orientation tag when
// $config['strip_exif'] is false and $config['convert_manual_orient'] is true.
$config['use_exiftool'] = false;
// Redraw the image to strip any excess data (commonly ZIP archives) WARNING: This might strip the
// animation of GIFs, depending on the chosen thumbnailing method. It also requires recompressing

View File

@ -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 {