0
Hello! I’m trying to insert watermark when registering the image, but the image is upada, only it does not insert the watermark and does not return errors, someone has some suggestion?
Follows code below:
foreach ($_FILES as $field => $file) {
if ($file['error'] == 0) {
if ($this->upload->do_upload($field)) {
$data = $this->upload->data();
$dados['imagem'] = $data['file_name'];
$img_config['wm_type'] = 'overlay';
$img_config['wm_overlay_path'] = PATH_FRONT_END_UPLOAD.'usuarios/logo.png';
$img_config['wm_x_transp'] = 20;
$img_config['wm_y_transp'] = 10;
$img_config['wm_opacity'] = 50;
$img_config['wm_vrt_alignment'] = 'bottom';
$img_config['wm_hor_alignment'] = 'center';
$config['source_image'] = $data['full_path'];
$this->image_lib->watermark();
$this->image_lib->clear();
$this->image_lib->initialize($config);
} else {
$errors = $this->upload->display_errors();
die($errors);
}
}
}
Hello! I tried to insert the libs before the foreach, but it also didn’t work :( updated the code and removed the code to insert Thumbs, because I don’t need Thumbs at the moment, so the code is much smaller and easier to understand.
– Maurício Krüger
Updated, try the code I refactored from your... Oss
– rpereira15