php - add watermark in CI -
i want add watermark on new uploded images. using ci.
public function watermark(){ $this->load->library('image_lib'); $config['source_image'] = 'uploads/gallery/d7315a9a3039541431ab8a41820b6f00.jpg'; $config['wm_text'] = 'copyright 2015'; $config['wm_type'] = 'text'; $config['wm_font_size'] = 16; $config['wm_font_color'] = 'ffffff'; $config['wm_vrt_alignment'] = 'middle'; $config['wm_hor_alignment'] = 'right'; $config['wm_padding'] = '20'; $this->image_lib->initialize($config); if (!$this->image_lib->watermark()) { echo $this->image_lib->display_errors(); }else{ echo "image created"; } }
it's not displaying error image not created.
try this
public function image_watermark()//change class name { $this->load->library('image_lib'); $config['source_image'] = 'uploads/gallery/d7315a9a3039541431ab8a41820b6f00.jpg'; $config['wm_text'] = 'copyright 2015'; $config['wm_type'] = 'text'; $config['wm_font_size'] = 16; $config['wm_font_color'] = 'ffffff'; $config['wm_vrt_alignment'] = 'middle'; $config['wm_hor_alignment'] = 'right'; $config['wm_padding'] = '5';//less padding $this->image_lib->initialize($config); if (!$this->image_lib->watermark()) { echo $this->image_lib->display_errors(); }else{ echo "image created"; } }
Comments
Post a Comment