【发布时间】:2011-10-14 00:17:07
【问题描述】:
所以我正在使用以下代码(成功)裁剪我上传的图像:
$file_name = $this->input->post('file_name');
$x1 = $this->input->post('x1');
$y1 = $this->input->post('y1');
$x2 = $this->input->post('x2');
$y2 = $this->input->post('y2');
//die('width: '.$width.' height: '.$height.' id: '.$id.' file_name: '.$file_name.' x1: '.$x1.' x2: '.$x2.' y1: '.$y1.' y2: '.$y2.' w: '.$w.' h: '.$h);
$config['image_library'] = 'gd2';
$config['source_image'] = './images/uploads/temp/'.$file_name;
$config['maintain_ratio'] = FALSE;
$config['width'] = $y2;
$config['height'] = $y2;
$config['x_axis'] = $x1;
$config['y_axis'] = $y1;
$this->image_lib->initialize($config);
此时我想调整图像的大小,因为我刚刚获得了我想要的选择和比例,但不知道该怎么做。以下是我认为随后会以同样的方法立即起作用的方法:
$config['width'] = 180;
$config['height'] = 180;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
if ( ! $this->image_lib->resize() )
{
die( $this->image_lib->display_errors() ); //
}
它不会给出任何错误或任何东西,它只是不会调整图像大小。你能帮我弄清楚发生了什么吗?
【问题讨论】:
标签: php codeigniter image-processing