我正在使用jQuery Cropper来获取用于裁剪图像的参数,这些参数是我在PHP中所做的。我想使用Imagick
,但我不明白imagecopyresampled
的含义。
jQuery Cropper to PHP Imagick:等效于imagecopy在Imagick中重新采样
•
问答
xajs18 回答:jQuery Cropper to PHP Imagick:等效于imagecopy在Imagick中重新采样
当前通过Cropper的getData()
函数,我得到了以下参数:
$dst_x = offset left of the cropped area
$dst_y = offset top of the cropped area
$dst_width = the width of the cropped area
$dst_height = the height of the cropped area.
我将这些参数通过ajax传递给PHP。
使用imagecopyresampled()
,我可以通过Cropper获得相同的裁剪区域。
假设我要获得最终的240x400图像。
$crop_width = 240;
$crop_height = 400;
$new_image = imagecreatetruecolor($crop_width,$crop_height);
imagecopyresampled($new_image,$source_image,$dst_x,$dst_y,$crop_width,$crop_height,$dst_width,$dst_height);
但是我想使用PHP Imagick进行图像处理,但是找不到类似于imagecopyresampled()
的函数来获得相同的效果。