答案 0 :(得分:1)
您可以使用imagecrop()方法裁剪任何图像,如下所示:
$filename = 'test.JPG';
$image = imagecreatefromjpeg($filename );
$x_size = getimagesize($filename)[0];
$y_size = getimagesize($filename)[1];
$crop_measure = min($x_size, $y_size);
header('Content-Type: image/jpeg');
$crop_array = array('x' =>0 , 'y' => 0, 'width' => $crop_measure, 'height'=> $crop_measure);
$thumb_image = imagecrop($image, $crop_array);