views:

396

answers:

1

I use the following code to create a thumbnail on the site:

$small_image = new Imagick($large_path."/".$pic['image']);
$small_image->thumbnailImage(100, 0);
$small_image->writeImage($small_path."/".$pic['image']);

It sets it's own quality and I tried adding

$small_image->setCompression(imagick::COMPRESSION_JPEG);
$small_image->setCompressionQuality(1);

But that didn't change a thing. I also tried

$img = new Imagick($small_path."/".$pic['image']);
$img->setCompression(Imagick::COMPRESSION_JPEG);
echo $img->setCompressionQuality(1); // should come out ugly
$img->writeImage();

But even that didn't change the size with quality 1. Any ideas what I'm doing wrong?

+1  A: 

I think you want:

$small_image->setImageCompression(imagick::COMPRESSION_JPEG);
$small_image->setImageCompressionQuality(1);

Note the "Image" between the "get"/"set" and "Compression".

VTEX