请注意,fxImage 的返回值类型是新的对象(Imagick),与当前文档(布尔值)相反。因此它不会影响调用者对象。示例
<?php
$canvas = new Imagick();
$canvas->newImage(256, 256, "white", "jpg");
$gradient = new Imagick();
$gradient->newPseudoImage(256, 256, "gradient:white-black");
$canvas->compositeImage( $gradient, imagick::COMPOSITE_OVER, 0, 0 );
$canvas->rotateImage(new ImagickPixel(), 90);
/*而不是只使用 $canvas->fxImage("floor(s*10+0.5)/10"); 我们必须存储 fxImage() 的结果*/
$canvas= $canvas->fxImage("floor(s*10+0.5)/10");
header( "Content-Type: image/jpg" );
echo $canvas;
?>