CodeIgniter水印

idan003

嗨,我的代码有问题

    $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();

我想要的是更新图像后将徽标从网上发布。但是如果我上传我会给我错误

错误是:

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
阿德里安·汤布(Adrian Tombu)

我认为问题出在这里

$img_config['source_image'] = $this->upload->do_multi_upload('userfile');

此函数执行文件的上载,并返回一个布尔值以检查上载是否成功。我没有提供图片的网址。

我想您正在使用此库进行多次上传:https : //github.com/stvnthomas/CodeIgniter-Multi-Upload

相反,您应该使用函数get_multi_upload_data()来查找要使用的正确文件。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章