开发者

How to crop image in Image_Canvas PHP PEAR package

开发者 https://www.devze.com 2022-12-18 04:18 出处:网络
I can\'t get it to work it just does nothing. I\'m using Image_Canvas PEAR package on shared hosting it works but I can\'t crop image.

I can't get it to work it just does nothing. I'm using Image_Canvas PEAR package on shared hosting it works but I can't crop image.

My syntax is:

$Ca开发者_如何学编程nvas->setClipping(array('x0' => 10, 'y0' => 10, 'x1' => 200, 'y1' => 200));

Any ideas?


I am not that familiar with Image_Canvas PEAR package, but I have tried it just now and found that setClipping will work if you add a second call to the same method without any parameters!

$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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号