[eluser]Ki[/eluser]
Not sure why, but image library alwasy gives the most problems from all CI libs.
I am trying to do the following:
Upload file->rename watermark resize->create thumb
Code:
//UPLOAD AND RESIZE THE FILE
$config = array();
$config['source_image'] = $uploaded_data['full_path'];
$config['new_image'] = $target;
$config['width'] = 700;
$config['height'] = 700;
$config['quality'] = 80;
$config['maintain_ratio'] = TRUE;
$config['create_thumb'] = FALSE;
$this->CI->load->library('image_lib',$config);
$this->CI->image_lib->resize();
$this->CI->image_lib->clear();
// create thumb
$config['source_image'] = $target;
$config['new_image'] = $this->config['upload_path'].'sml_'.$file_name.'.jpg';
$config['create_thumb'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->CI->image_lib->initialize($config);
$this->CI->image_lib->resize();
$this->CI->image_lib->clear();
//add watermark
$config=array();
$config['source_image'] = $target;
$config['wm_text'] = 'Copyright 2006 - John Doe';
$config['wm_type'] = 'text';
$config['wm_overlay_path'] = './logo/overlay.gif';
$config['wm_type'] = 'overlay';
$config['wm_vrt_alignment'] = 'top';
$config['wm_hor_alignment'] = 'right';
$config['dynamic_output'] = FALSE;
$config['create_thumb'] = FALSE;
$this->CI->image_lib->initialize($config);
$this->CI->image_lib->watermark();
It creates the resized version but does not add watermark.
An a remark: Does anybody else find the $config['create_thumb'] useless? After all, it requires to specify width and height, so what is the point if same can be acomplished with resize? Is there any way I can resize uploaded image, watermark and create thumb in one shot?