我无法让它工作,它什么也没做。我在共享主机上使用 Image_Canvas PEAR 包,它可以工作,但我无法裁剪图像。
我的语法是:
$Canvas->setClipping(array('x0' => 10, 'y0' => 10, 'x1' => 200, 'y1' => 200));
有任何想法吗?
我对 Image_Canvas PEAR 包不是很熟悉,但是我刚刚尝试过,发现如果您在没有任何参数的情况下对同一方法添加第二次调用,setClipping 将起作用!
$Canvas =& Image_Canvas::factory((isset($_GET['canvas']) ? $_GET['canvas'] : 'png'), array('width' =>500, 'height' => 333, 'filename' => 'yourImage.jpg'));
$Canvas->setClipping(array('x0' => 10, 'y0' => 10, 'x1' => 200, 'y1' => 200));
$Canvas->image(array('x' => 0, 'y' => 0, 'filename' => './yourImage.jpg'));
$Canvas->setClipping();
$Canvas->show();