[eluser]Kemik[/eluser]
Hey all,
I'm trying to make a thumbnail of an uploaded image and the watermark the original. However, with the code below it seems to make a copy (called _thumb) and watermarks the image but doesn't make it smaller.
Code:
$source = $this->upload->data();
// upload complete. create thumbnail, watermark original and insert in to DB
$config['image_library'] = 'gd2';
$config['source_image'] = $source['full_path'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 180;
$config['height'] = 120;
$this->load->library('image_lib', $config);
/*if ( ! $this->image_lib->resize())
{
$this->load->view('includes/header');
$this->load->view('gallery_upload', array('error' => $this->image_lib->display_errors()));
$this->load->view('includes/footer');
}*/
$this->image_lib->resize();
$this->image_lib->clear();
$config = array();
$config['source_image'] = $source['full_path'];
$config['wm_text'] = 'Cheshire Mud Rats';
$config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/Arial.ttf';
$config['wm_font_size'] = '28';
$config['wm_font_color'] = 'ffffff';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '-30';
$this->image_lib->initialize($config);
$this->image_lib->watermark();
I need a thumbnail (_thumb) of the original and then the uploaded file needs to be watermarked. Basic idea being, the thumbnails are for the overview of the gallery and the watermarked files are for when the user clicks a thumbnail.
Any ideas where I'm going wrong? Thanks.