[eluser]Unknown[/eluser]
Hi all i'm trying cropping then resizing images for create thumbs .... i don't think my lib crop() functions still working cause i see images only resized at 80x80 px but not cropped first
no errors from echo $this->image_lib->display_errors() returns
i would like to ... first (according to original $imgWidth and $imgHeight) crop them and make them squared , then resize them to a fixed thumb dimension (80x80px) .... but seems something wrong with cropping still not working maybe !?
Code:
$this->load->library('image_lib');
if($imgWidth > $imgHeight){
$img['image_library'] = 'gd2';
$img['source_image'] = 'uploads/img/gallery/small/'.$photo;
$img['maintain_ratio'] = FALSE;
$img['x_axis'] = $imgWidth - $imgHeight;
$img['y_axis'] = $imgHeight;
$this->image_lib->initialize($img);
$this->image_lib->crop();
echo $this->image_lib->display_errors();
}
if($imgWidth < $imgHeight){
$img['image_library'] = 'gd2';
$img['source_image'] = 'uploads/img/gallery/small/'.$photo;
$img['maintain_ratio'] = FALSE;
$img['x_axis'] = $imgWidth;
$img['y_axis'] = $imgHeight-$imgWidth;
$this->image_lib->initialize($img);
$this->image_lib->crop();
echo $this->image_lib->display_errors();
}
$img['image_library'] = 'gd2';
$img['source_image'] = 'uploads/img/gallery/small/'.$photo;
$img['maintain_ratio'] = FALSE;
$img['width'] = 80;
$img['height'] = 80;
$this->image_lib->initialize($img);
$this->image_lib->resize();
echo $this->image_lib->display_errors();
check this code someone have any idea?