hi I have a problem with my code
$obj = new stdClass();
$obj->cat_id = !empty($_POST['cat_id']) ? $_POST['cat_id'] : '';
$obj->num_chapter = !empty($_POST['num_chapter']) ? $_POST['num_chapter'] : '';
$obj->tags = !empty($_POST['tags']) ? $_POST['tags'] : '';
$obj->date = date("Y-m-d H:i:s");
$config['upload_path'] = $this->model_mangachapt->Add($obj);
$config['encrypt_name'] = false;
$config['allowed_types'] = "png|jpg|jpeg";
$config['max_size'] = "1000000";
$this->upload->initialize($config);
$img_config['source_image'] = $this->upload->do_multi_upload('userfile');
$img_config['image_library'] = 'gd2';
$img_config['wm_type'] = 'overlay';
$img_config['wm_overlay_path'] = './images/logo.gif';
$img_config['wm_vrt_alignment'] = 'middle';
$img_config['wm_hor_alignment'] = 'center';
$this->image_lib->initialize($img_config);
print $this->image_lib->watermark();
I want after is update the image is give the logo off the web. but if I upload I give me error
the error is:
A PHP Error was encountered
Severity: Warning
Message: imagecolorat() expects parameter 1 to be resource, boolean given
Filename: libraries/Image_lib.php
Line Number: 953
I think the problem is located here
$img_config['source_image'] = $this->upload->do_multi_upload('userfile');
This function performs the upload of the files, and returns a boolean to check if the upload is successful or not. I does not give the url of an image.
I guess you are using this library for multiple uploads : https://github.com/stvnthomas/CodeIgniter-Multi-Upload
You should instead use the function get_multi_upload_data() to find the correct file to use.