我正在上传图片,当时我还想添加水印图片。
我正在使用Ajax功能上传图片。
怎么做?
代码:
$this->load->library('upload');
$this->load->library('image_lib');
$config['image_library'] = 'GD2';
$id = $_POST['id'];
$UPLD_PATH = $this->admin_model->UPLD_PATH($id);
$config['upload_path'] = './application/assets/images/' . $UPLD_PATH;
$config['file_name'] = date('dmYHis');
$config['allowed_types'] = 'gif|jpg|png|mp4|ogv|zip';
$config['wm_overlay_path'] ='./application/assets/images/example.gif';
$config['wm_text'] = 'Copyright ' . date('y') . ' - example.com';
$config['wm_type'] = 'overlay';
$config['wm_font_path'] = './application/assets/fonts/fontawesome-webfont.ttf';
$config['wm_font_size'] = '16';
$config['wm_opacity'] = '50';
$config['wm_font_color'] = 'ffffff';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '20';
$this->upload->initialize($config);
$this->load->library('upload', $config);
if (!is_dir($config['upload_path'])) {
mkdir($config['upload_path'], 0777, true);
}
$this->image_lib->initialize($config);
$this->image_lib->watermark();
$files = $_FILES;
$number_of_files = count($_FILES['file']['name']);
$errors = 0;