[eluser]abada[/eluser]
plz help
i want to upload and watermark my uploaded images
upload success but watermark faild !
here is my code
Code:
function uploadimg()
{
$uploaddir = './uploads/';
$config['upload_path'] = $uploaddir;
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$config['max_size'] = '0';
//$field_name = $_FILES['userfile']['name'];
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
echo $this->upload->display_errors('<p>', '</p>');
}
else
{
$data = $this->upload->data();
//echo $data['file_name'];
//for watermark
echo$this->wmimages($data['file_name']);
//
}
}
function wmimages($mgsrc='')
{
$this->load->library('image_lib');
$config['create_thumb'] = FALSE;
$config['source_image'] = base_url().'uploads/'.$mgsrc;
$config['wm_text'] = 'Copyright 2006 ';
$config['wm_type'] = 'text';
$config['wm_font_path'] =base_url().'system/fonts/texb.ttf';
$config['wm_font_size'] = '16';
$config['wm_font_color'] = 'ffffff';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'left';
$config['wm_padding'] = '20';
$config['wm_opacity'] = '100';
$config['wm_vrt_offset'] = '-90';
$config['wm_hor_offset'] = 'right';
$this->image_lib->initialize($config);
if(!$this->image_lib->watermark())
return 0;
else return 1;
}
i test it by return 0 or 1
it always return 0 so images not have a watermark
thanks 4 all