(PECL imagick 2.0.0)
Imagick::scaleImage — Scales the size of an image
$cols
, int $rows
[, bool $bestfit
= FALSE
[, bool $legacy
= FALSE
]] ) : boolScales the size of an image to the given dimensions. The other parameter will be calculated if 0 is passed as either param.
Note: ����
bestfit
�������� Imagick 3.0.0 ���Ѹı䡣�ڴ˰汾��ǰ����Ŀ��ߴ���Ϊ 400x400 ʱ��ԭ�ߴ�Ϊ 200x150 ��ͼ���ᱻ�ı䡣�� Imagick 3.0.0 ��Դͼ�ᱻ�Ŵ� 400x300 ��Ϊ�⽫���õ��ʺ�Ŀ��ߴ硣��ʹ�ò���bestfit
ʱ������ͬʱ������Ⱥ߶ȡ�
cols
rows
bestfit
�ɹ�ʱ���� TRUE
��
����ʱ�׳� ImagickException��
�汾 | ˵�� |
---|---|
2.1.0 | Added optional fit parameter. This method now supports proportional scaling. Pass zero as either parameter for proportional scaling. |
Example #1 Imagick::scaleImage()
<?php
function scaleImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->scaleImage(150, 150, true);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>