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
This commit is contained in:
parent
95059f2bfd
commit
55dc6fbc1c
@ -17,30 +17,12 @@ class Webfinger extends \Zotlabs\Web\Controller {
|
||||
|
||||
$o .= '<br /><br />';
|
||||
|
||||
$old = false;
|
||||
if(x($_GET,'addr')) {
|
||||
$addr = trim($_GET['addr']);
|
||||
// if(strpos($addr,'@') !== false) {
|
||||
|
||||
$res = webfinger_rfc7033($addr,true);
|
||||
if(! $res) {
|
||||
$res = old_webfinger($addr);
|
||||
$old = true;
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// if(function_exists('lrdd'))
|
||||
// $res = lrdd($addr);
|
||||
// }
|
||||
|
||||
if($res && $old) {
|
||||
foreach($res as $r) {
|
||||
if($r['@attributes']['rel'] === 'http://microformats.org/profile/hcard') {
|
||||
$hcard = unamp($r['@attributes']['href']);
|
||||
require_once('library/HTML5/Parser.php');
|
||||
$res['vcard'] = scrape_vcard($hcard);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,6 +75,7 @@ abstract class photo_driver {
|
||||
|
||||
abstract function imageString();
|
||||
|
||||
abstract function clearexif();
|
||||
|
||||
public function __construct($data, $type='') {
|
||||
$this->types = $this->supportedTypes();
|
||||
|
@ -35,6 +35,11 @@ class photo_gd extends photo_driver {
|
||||
}
|
||||
|
||||
|
||||
public function clearexif() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function destroy() {
|
||||
if($this->is_valid()) {
|
||||
imagedestroy($this->image);
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user