【发布时间】:2018-07-13 04:46:10
【问题描述】:
我从 UI 发送了source_image、x_axis、y_axis、height 和 width 来处理图像(在这种情况下我裁剪图像),这是我的代码:
$this->load->library('image_lib');
$image = $this->input->post('source_image');
//array configuration for clock-wise and counter-clock-wise
$angle = array(
0 => 0,
90 => 270,
180 => 180,
270 => 90
);
$rotation = $this->input->post('rotation');
$x = $this->input->post('x');
$y = $this->input->post('y');
$width = $this->input->post('width');
$height = $this->input->post('height');
$result = array();
$config['image_library'] = 'gd2';
$config['source_image'] = $image;
$config['x_axis'] = $x;
$config['y_axis'] = $y;
$config['maintain_ratio'] = TRUE;
$config['width'] = $width;
$config['height'] = $height;
$this->image_lib->initialize($config);
if (!$this->image_lib->crop()) {
$result = array(
'result' => FALSE,
'error' => $this->image_lib->display_errors()
);
}
当我完成裁剪图像然后我再次检查它改变的分辨率时,例如:
width: 197px;
height: 173px;
它应该是我完成裁剪时的分辨率,但是当我检查它时,分辨率变成了
width: 181px;
height: 173px;
在其他情况下,有时宽度会改变,有时高度也会改变..
配置$config 或其他什么时我错了吗?谢谢
【问题讨论】:
标签: php codeigniter gd