aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-22 18:12:16 -0700
committerzotlabs <mike@macgirvin.com>2018-04-22 18:12:16 -0700
commit55dc6fbc1cae70e4f2b207c517c8c9155fda9662 (patch)
tree9ddc0e8c082e01695d6156f9a98407cc6824b254 /include
parent95059f2bfd2c7dbffe4dba2df277f7356fb124a1 (diff)
downloadvolse-hubzilla-55dc6fbc1cae70e4f2b207c517c8c9155fda9662.tar.gz
volse-hubzilla-55dc6fbc1cae70e4f2b207c517c8c9155fda9662.tar.bz2
volse-hubzilla-55dc6fbc1cae70e4f2b207c517c8c9155fda9662.zip
imagemagick preserves exif when scaling. GD does not. We do not want to preserve exif on thumbnails which we have rotated, as a browser reading the exif information could rotate them yet again. This checkin adds an abstract function to the generic photo driver which makes the behaviour consistent by stripping EXIF from imagick processed images. However, we will attempt to preserve any ICC colour profiles. See http://php.net/manual/en/imagick.stripimage.php
Diffstat (limited to 'include')
-rw-r--r--include/photo/photo_driver.php1
-rw-r--r--include/photo/photo_gd.php5
-rw-r--r--include/photo/photo_imagick.php13
-rw-r--r--include/photos.php4
4 files changed, 23 insertions, 0 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 22d2b776d..2e2f5a758 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -75,6 +75,7 @@ abstract class photo_driver {
abstract function imageString();
+ abstract function clearexif();
public function __construct($data, $type='') {
$this->types = $this->supportedTypes();
diff --git a/include/photo/photo_gd.php b/include/photo/photo_gd.php
index 24bdc204f..e98ac2827 100644
--- a/include/photo/photo_gd.php
+++ b/include/photo/photo_gd.php
@@ -35,6 +35,11 @@ class photo_gd extends photo_driver {
}
+ public function clearexif() {
+ return;
+ }
+
+
public function destroy() {
if($this->is_valid()) {
imagedestroy($this->image);
diff --git a/include/photo/photo_imagick.php b/include/photo/photo_imagick.php
index 32bb61342..89577e71e 100644
--- a/include/photo/photo_imagick.php
+++ b/include/photo/photo_imagick.php
@@ -96,6 +96,19 @@ class photo_imagick extends photo_driver {
}
+ public function clearexif() {
+
+ $profiles = $this->image->getImageProfiles("icc", true);
+
+ $this->image->stripImage();
+
+ if(!empty($profiles)) {
+ $this->image->profileImage("icc", $profiles['icc']);
+ }
+ }
+
+
+
public function getImage() {
if(!$this->is_valid())
return FALSE;
diff --git a/include/photos.php b/include/photos.php
index 321f7159c..9ae0e6874 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -211,6 +211,10 @@ function photo_upload($channel, $observer, $args) {
$ph->orient($exif);
}
+
+ $ph->clearexif();
+
+
@unlink($src);
$max_length = get_config('system','max_image_length');