[eluser]morph london[/eluser]
I have this script working on my site, the thumb is created to size but the crop is not applied, any suggestions would be great:
Code:
function image()
{
$folder = "assets/images/content/".$this->uri->segment(3)."/".$this->uri->segment(4)."/";
if(!file_exists($folder)) mkdir($folder, 0777);
move_uploaded_file($_FILES['Filedata']['tmp_name'], $folder."main.jpg");
if(file_exists($folder."main.jpg"))
{
$this->load->library('image_lib');
chmod($folder."main.jpg", 0777);
// RESIZE
$config['image_library'] = 'GD2';
$config['source_image'] = $folder."main.jpg";
$config['maintain_ratio'] = FALSE;
$config['width'] = 490;
$config['height'] = 234;
$this->image_lib->clear();
$this->image_lib->initialize($config);
$this->image_lib->resize();
// THUMB
$config['image_library'] = 'GD2';
$config['source_image'] = $folder."main.jpg";
$config['new_image'] = $folder."thumb.jpg";
$config['maintain_ratio'] = TRUE;
$config['height'] = 118;
$config['width'] = 247;
$this->image_lib->clear();
$this->image_lib->initialize($config);
$this->image_lib->resize();
//CROP THUMB
//$config['image_library'] = 'GD2';
$config['source_image'] = $folder."thumb.jpg";
$config['x_axis'] = '109';
$config['y_axis'] = '118';
$this->image_lib->clear();
$this->image_lib->initialize($config);
$this->image_lib->crop();
chmod($folder."thumb.jpg", 0777);
}
}