I have this function above witch even maintain_ration set false, cutting with this proportion. In this case the result is an image with 150x113px, because the original image has 400x300.
function do_crop() {
$config = array(
'image_library' => 'gd2',
'source_image' => realpath(APPPATH . '../upload_img/solg6.jpg'),
'new_image' => $this->gallery_path_url . 'thumbaaa.jpg',
'maintain_ration' => false,
'width' => 150,
'height' => 150,
'x_axis' => 20,
'y_a开发者_如何学编程xis' => 20
);
$this->load->library('image_lib');
$this->image_lib->initialize($config);
if ( ! $this->image_lib->crop())
{
echo $this->image_lib->display_errors();
}
$this->image_lib->clear();
}
I just want crop without ratio.
I think the problem is that you mispelled the setting name in the configuration. It is "maintain_ratio", not "maintain_ration".
The default value for this setting is true and you are not overriding it. The image is being cropped with the ratio maintained.
精彩评论