CodeIgniter Forums
an upload model (upload - resize - watermark) problem it wont resize!!! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: an upload model (upload - resize - watermark) problem it wont resize!!! (/showthread.php?tid=13791)



an upload model (upload - resize - watermark) problem it wont resize!!! - El Forum - 12-05-2008

[eluser]LDMajor[/eluser]
Code:
function upic($fieldn, $usern, $order=0) {
        $this->load->library('image_lib');
        $pathme=realpath('photos');
        $pathimg=realpath('img');
          // upload
         $config['upload_path'] = $pathme;
        $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
        $config['encrypt_name']= TRUE;
        $picin['order']=$order;
        $picin['user']=$usern;
        $this->load->library('upload', $config);
        if ( ! $this->upload->do_upload($fieldn)) {
        //    die ($this->upload->display_errors());
        } else {
            $picin['name']=$this->upload->getme();
            $this->db->insert('pics', $picin);
            $config['width'] = 370;
            $resize_config['source_image'] = $pathme."/".$picin['name'];
            $resize_config['width'] = 370;
            $resize_config['maintain_ratio']=TRUE;
            $this->load->library('image_lib', $resize_config);
            // RESIZE
            $resize_config['source_image'] = $pathme."/".$picin['name'];
            $resize_config['width'] = 370;
            $resize_config['maintain_ratio']=TRUE;
            $this->image_lib->initialize($resize_config);
            $this->image_lib->resize();
            // END RESIZE
            // WM
            $wm_config['source_image'] = $pathme."/".$picin['name'];
            $wm_config['wm_type'] = 'overlay';
            $wm_config['quality']='100';
            $wm_config['padding']='2';
            $wm_config['wm_vrt_alignment']='bottom';
            $wm_config['wm_hor_alignment']='right';
            $wm_config['wm_overlay_path']=$pathimg."/WM.png";
            $wm_config['wm_opacity']='80';
            $this->image_lib->initialize($wm_config);
            $this->image_lib->watermark();
            // END WM
        }
    }

everything is good but the thing wont resize the picture

thanks Dan.


an upload model (upload - resize - watermark) problem it wont resize!!! - El Forum - 12-05-2008

[eluser]crumpet[/eluser]
do this and see what you get
Code:
if ( ! $this->image_lib->resize()){
    return $this->image_lib->display_errors();
}



an upload model (upload - resize - watermark) problem it wont resize!!! - El Forum - 09-04-2009

[eluser]Unknown[/eluser]
Code:
$this->image_lib->watermark();// do this first;

$this->image_lib->resize();

order problem