©
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
(PECL imagick 2.0.0)
Imagick::setImageCompression — 设置图片压缩的类型
$compression
)
compression
COMPRESSION
常量里的一种
成功时返回 TRUE
。
错误时抛出 ImagickException。
[#1] snipes2083 [at] yahoo com [2010-03-28 10:03:35]
Above it says "One of the COMPRESSION constants" for the parameters. For any of you that found this confusing, you can find a list of the constants here:
Predefined Constants
http://www.php.net/manual/en/imagick.constants.php
As an example for working with a jpeg image:
<?php
$image = 'jpeg_image.jpg';
$comression_type = Imagick::COMPRESSION_JPEG;
$im = new Imagick($image);
$im->setImageCompression($compression_type);
?>
This class does not actually compress the images but rather sets the compression type that is going to be used.
If you would like to see how to compress the image see:
Imagick::setImageCompressionQuality