我有下面的代码,如果我不使用水印它很好但是当我使用水印时,原始图片和缩略图变得非常小,水印发生在缩略图上,我想在原始图像上有水印,请帮助
//UPLOAD IMAGE
//some $config vars for image
$config['upload_path'] = './images/blog';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '0';
$config['remove_spaces'] = true;
$config['overwrite'] = false;
$config['max_width'] = '0';
$config['max_height'] = '0';
$this->load->library('upload', $config);
//upload main image
if(!$this->upload->do_upload('photo')){
$e = $this->upload->display_errors();
print_r($e);
}
$image = $this->upload->data();
//thumbnail creation start
$config1['image_library'] = 'gd2';
$config1['source_image'] = $image['full_path'];
$config1['create_thumb'] = TRUE;
$config1['maintain_ratio'] = TRUE;
$config1['width'] = 75;
$config1['height'] = 50;
$this->load->library('image_lib', $config1);
$this->image_lib->resize();
//thumbnail creation ends
$this->image_lib->clear();
//$image = $this->upload->data();
//start watermarking
$config2['source_image'] = $image['full_path'];
$config2['wm_text'] = 'Copyright 2011 myself';
$config2['wm_type'] = 'text';
$config2['wm_font_path'] = './system/fonts/FromWhereYouAre.ttf';
$config2['wm_font_size'] = '16';
$config2['wm_font_color'] = 'ffffff';
$config2['wm_vrt_alignment'] = 'middle';
$config2['wm_hor_alignment'] = 'center';
$config2['wm_padding'] = '20';
$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->watermark();
//end watermarking
答案 0 :(得分:3)
请尝试添加
$config2['new_image'] = '';
水印代码中的