CodeIgniter Forums
Support for stripping exif in ImageMagickHandler - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Support for stripping exif in ImageMagickHandler (/showthread.php?tid=82610)



Support for stripping exif in ImageMagickHandler - blurpy - 07-29-2022

In CodeIgniter 3 I patched image_lib to strip exif when resizing using imagemagick.
Here:
https://github.com/bcit-ci/CodeIgniter/blob/9b8f2b7a8405acd1b8ad5956ada3d84472b1e8ae/system/libraries/Image_lib.php#L872

PHP Code:
public function image_process_imagemagick($action 'resize')
{
...
  // Execute the command
  $cmd $this->library_path.' -quality '.$this->quality;
  $cmd .= " -strip "; <-- added this
... 
Now I need this when migrating to CodeIgniter 4. Could this be added as an optional feature in ImageMagickHandler?

Something along the lines of:

PHP Code:
$this->image->withFile($fullImagePath)
            ->resize($imageWidth$imageHeighttrue)
            ->stripExif()
            ->save($scaledImagePath70);