1

I'm using JImage to generate .jpg image thumbnails.

$image = new JImage($image_src);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'path/to/photo_thumbnail.jpg', IMAGETYPE_JPEG);

How can I set the generated jpg image quality to 70%?

3

The third argument in toFile is the options array, which includes 'quality' as a key. eg.

$thumb = $resizedImage->toFile(JPATH_BASE.'path/to/photo_thumbnail.jpg', IMAGETYPE_JPEG, array('quality' => 70));

API Doc for Image https://api.joomla.org/cms-3/classes/Joomla.Image.Image.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.