iMagick 在 Windows 服务器上透视扭曲


iMagick Distort in perspective on windows server

我正在尝试通过imagick php扩展在透视中扭曲图像,我有以下代码来执行此操作:

    $controlPoints = array(
                    0,0, 0,0, 
                    0,$height, 0,$height, 
                    $width,0, $width,$perspective_wrap, 
                    $width,$height, $width,$hps
                    );
$im1->setImageMatte(true);
//Distort the image -- In perspective with the matrix given above
$im1->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);  



图像在 linux 服务器上的透视扭曲,但是当我在托管的 Windows 上移动脚本时,似乎发生了以下错误:
致命错误:未捕获异常"ImagickException",消息为"无法读取参数数组"
其中线条为 $im 1->distortImage(Imagick::D ISTORTION_PERSPECTIVE, $controlPoints, true);

有没有办法让它在两个平台上工作?

似乎在我的 linux 服务器上,我有以下 Imagick 版本:
图像魔术版本: 图像魔术 6.7.6-8 2012-05-02 Q16

在Windows服务器上:

ImageMagick 版本 ImageMagick 6.4.1 08-05-16 Q16


因此,在 Windows 服务器上,$controlPoints数组必须将所有元素作为 INT 值。在 linux 服务器和那个图像魔术版本上,如果某些值是字符串,则没有问题,因此问题的解决方案是将$controlPoints数组值转换为 int 值。
如果有人像我一样解决这个问题,希望会有所帮助。