<?php
include_once 'imagick.php';
$im = imagegrabscreen();
imagepng($im, "myscreenshot.png");
imagedestroy($im);
$im = new Imagick('myscreenshot.png');
$imageprops = $im->getImageGeometry();
$width = $imageprops['width'];
$height = $imageprops['height'];
if($width > $height){
$newHeight = 80;
$newWidth = (80 / $height) * $width;
}else{
$newWidth = 80;
$newHeight = (80 / $width) * $height;
}
$im->resizeImage($newWidth,$newHeight, imagick::FILTER_LANCZOS, 0.9, true);
$im->cropImage (80,80,0,0);
$im->writeImage( "test.jpg" );
echo '<img src="test.jpg">';
?>
正确保存图像。但是我收到了这个错误:
致命错误:无法覆盖最终方法Exception :: __ clone()in C:\ XAMPP \ htdocs中\