summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php3
-rw-r--r--inc/image.php12
2 files changed, 13 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index 424d07d6..c2a68e6c 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -418,6 +418,9 @@
// - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in PHP Imagick.
$config['thumb_method'] = 'gd';
+ // Strip EXIF metadata from JPEG files
+ $config['strip_exif'] = false;
+
// Regular expression to check for IE MIME type detection XSS exploit. To disable, comment the line out
// https://github.com/savetheinternet/Tinyboard/issues/20
$config['ie_mime_type_detection'] = '/<(?:body|head|html|img|plaintext|pre|script|table|title|a href|channel|scriptlet)/i';
diff --git a/inc/image.php b/inc/image.php
index abe27bcb..eb98ceda 100644
--- a/inc/image.php
+++ b/inc/image.php
@@ -166,6 +166,9 @@ class ImageImagick extends ImageBase {
}
}
public function to($src) {
+ if ($config['strip_exif']) {
+ $this->image->stripImage();
+ }
if (preg_match('/\.gif$/i', $src))
$this->image->writeImages($src, true);
else
@@ -236,9 +239,14 @@ class ImageConvert extends ImageBase {
}
}
public function to($src) {
+ global $config;
+
if (!$this->temp) {
- // $config['redraw_image']
- shell_exec('convert ' . escapeshellarg($this->src) . ' ' . escapeshellarg($src));
+ if ($config['strip_exif']) {
+ shell_exec('convert ' . escapeshellarg($this->src) . ' -strip ' . escapeshellarg($src));
+ } else {
+ shell_exec('convert ' . escapeshellarg($this->src) . ' ' . escapeshellarg($src));
+ }
} else {
rename($this->temp, $src);
chmod($src, 0664);