CodeIgniter Forums
Reduce quality in Image Manipulation Class - 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: Reduce quality in Image Manipulation Class (/showthread.php?tid=74206)



Reduce quality in Image Manipulation Class - paul - 08-27-2019

Hello
Is it possible to set quality when Image Manipulation Class with ImageMagick or GD ?
It is possible in CI3 but it does not look possible CI4 Confused


RE: Reduce quality in Image Manipulation Class - php_rocs - 08-27-2019

@paul,

You can specify which image library you wish to use by setting the $config['image_library'] field (https://codeigniter.com/user_guide/libraries/image_lib.html?highlight=image#processing-an-image).  This is for CI3.

Just don't forget that you must have the extension installed with PHP.


RE: Reduce quality in Image Manipulation Class - MGatner - 08-27-2019

@paul you do it when you save the image: `public function save(string $target = null, int $quality = 90)`
Worth noting though that it is only supported for JPEGs.

Ref. https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Images/Handlers/GDHandler.php#L318


RE: Reduce quality in Image Manipulation Class - paul - 08-28-2019

Thx MGatner

That is what i wanted

maybe it should be added to the documentation


RE: Reduce quality in Image Manipulation Class - MGatner - 08-28-2019

Here ya go: https://github.com/codeigniter4/CodeIgniter4/pull/2169