Php CodeIgniter不使用图像库添加水印

Php CodeIgniter不使用图像库添加水印,php,codeigniter,watermark,Php,Codeigniter,Watermark,我正在尝试在上传的图像上添加水印,但它不起作用。。这是我的代码,我看不到任何错误 $data['photo_name'] = $data['slogan']; $data['photo_ext'] = end(explode('.', $photoValue)); $data['photo_name'] = $data['photo_name'] . '.' . $data['photo_ext']; file_

我正在尝试在上传的图像上添加水印,但它不起作用。。这是我的代码,我看不到任何错误

$data['photo_name'] = $data['slogan'];
            $data['photo_ext'] = end(explode('.', $photoValue));

            $data['photo_name'] = $data['photo_name'] . '.' . $data['photo_ext'];

                file_put_contents($_SERVER["DOCUMENT_ROOT"] .'/'. PHOTOS_UPLOAD_FOLDER . $data['photo_name'], file_get_contents($photoValue));
//                $this->resize_image($_SERVER["DOCUMENT_ROOT"] .'/'. PHOTOS_UPLOAD_FOLDER . $data['photo_name']);
                $this->simpleimage->load($data['photosData']['uploadFolder'] . $data['photo_name']);
                $this->simpleimage->cutFromCenter(450, 450);
                $this->simpleimage->save($_SERVER["DOCUMENT_ROOT"] .'/'. PHOTOS_UPLOAD_FOLDER . $data['photo_name']);

                // add watermark
                $configImg = array();
                $configImg['image_library'] = 'gd2';
                $configImg['wm_type'] = 'overlay';
                $configImg['source_image'] = $_SERVER["DOCUMENT_ROOT"] .'/'. PHOTOS_UPLOAD_FOLDER . $data['photo_name'];
                $configImg['wm_overlay_path'] = base_url('assets/logo.png');
                $configImg['wm_opacity'] = '50';
                $configImg['wm_vrt_alignment'] = 'middle';
                $configImg['wm_hor_alignment'] = 'center';

                $this->image_lib->initialize($configImg);
                $this->image_lib->watermark();
                $this->image_lib->clear();
                $this->image_lib->display_errors();
                print_r($configImg);
而且它不会打印任何错误。 它只打印我的数组

Array
(
    [image_library] => gd2
    [wm_type] => overlay
    [source_image] => ../king-include/uploads/possibly-the-best-youtube-comment-ever-.jpg
    [wm_overlay_path] => http://www.domain.info/parser/assets/logo.png
    [wm_opacity] => 100
    [wm_vrt_alignment] => top
    [wm_hor_alignment] => center
)

source_image:设置源映像名称/路径。路径必须是相对或绝对服务器路径,而不是URL


问题在于您的水印覆盖图像。将其设置为正确的路径,然后重试。

是否尝试将display_errors()置于clear()函数之前?第二个代码示例不同,因为$configImg这正常吗?