Lack of interest Preserve EXIF info in attachments (ImageMagick)

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Barry13

Member
Hello,

When Xenforo calls ImageMagick (PECL version, fwiw), it calls the 'thumbnailImage' function instead of resizeImage (or adaptiveResizeImage).
(resizeImage is only used by Xenforo for Scaling Up)

This can be seen in the php file
\upload\library\XenForo\Image\ImageMagick\Pecl.php:
Code:
foreach ($this->_image AS $frame)
{
   if ($scaleUp)
   {
      $frame->resizeImage($width, $height, Imagick::FILTER_QUADRATIC, .5, true);
   }
   else if ($oldImagick)
   {
      $frame->thumbnailImage($width, $height, true);
   }
   else
   {
      $frame->thumbnailImage($width, $height, true, true);
   }
   $frame->setImagePage($width, $height, 0, 0);
}

I believe this would be the correct change:
Code:
foreach ($this->_image AS $frame)
{
   if ($scaleUp)
   {
       $frame->resizeImage($width, $height, Imagick::FILTER_QUADRATIC, .5, true);
   }
   else if ($oldImagick)
   {
       $frame->resizeImage($width, $height, Imagick::FILTER_QUADRATIC, .5, true);  // keep EXIF
   }
   else
   {
       $frame->adaptiveResizeImage($width, $height, true);   // higher-quality scaling + EXIF retained
   }
   $frame->setImagePage($width, $height, 0, 0);
}

And make sure ImageMagick version >= 6.2.9 is installed.


references:
https://php.net/manual/en/imagick.adaptiveresizeimage.php (req. ImageMagick version >= 6.2.9)
PHP: Imagick::resizeImage - Manual
https://stackoverflow.com/questions/22534752/imagemagick-preserve-exif-data said:
You should not use the thumbnailImage image method if you want to preserve exif data... You should use the method resizeImage instead.
ImageMagick Preserve Exif Data

Thank you,
Barry
 
Upvote 5
This suggestion has been closed. Votes are no longer accepted.
Would be great if the edited file could be included in core so that Xenforo doesn't strip EXIF on image resize. Also, the edited file does a higher quality image resize!

Most people don't want to have EXIF data in uploaded photos! It is a huge security problem if location data remains in uploaded files.
 
Most people don't want to have EXIF data in uploaded photos! It is a huge security problem if location data remains in uploaded files.
I think each admin should have the option to decide this for himself and the needs of his forum.
 
Top Bottom