简体   繁体   English

Codeigniter添加水印失败

[英]Codeigniter adding watermark fails

For my page i want the user to be able to add images and automaticly add a watermark to the image. 对于我的页面,我希望用户能够添加图像并自动向图像添加水印。 My code : 我的代码:

//upload the image 
$this->image_lib->clear();

$this->load->library('image_lib');
$configthumb['image_library'] = 'gd2';

//create the watermark
$configthumb['source_image']    = $_SERVER['DOCUMENT_ROOT'].'/assets/img/design/full/'.$filename;
$configthumb['wm_type'] = 'overlay';
$configthumb['wm_overlay_path'] = './assets/img/watermark/watermark.png';
$configthumb['wm_opacity'] = 50;
$this->image_lib->initialize($configthumb); 

if ( ! $this->image_lib->watermark())
{
    echo $configthumb['source_image'];
    echo $this->image_lib->display_errors();
    echo     "error occured";
}
    echo $configthumb['source_image'];

If i run it i get : 如果我运行它,我得到:

Severity: Warning Message: imagecopymerge() expects parameter 9 to be long, string given Filename: libraries/Image_lib.php Line Number: 954 严重性:警告消息:imagecopymerge()期望参数9长,给定字符串文件名:librarys / Image_lib.php行号:954

But it dos not run the echo "error occured"; 但是它不会运行回显“发生错误”;

i checked the img Image_lib.php 954 and it says: 我检查了img Image_lib.php 954,它说:

imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity);

so i checked what the value of wm_opicty is and it is 50 所以我检查了wm_opicty的值是什么,它是50

Can some one help me solve this error? 有人可以帮我解决这个错误吗? I also changed $config['wm_opacity'] = 50; 我还更改了$ config ['wm_opacity'] = 50; to "50" and tryd completely remove the line, but i still get the same error. 到“ 50”并尝试完全删除该行,但是我仍然遇到相同的错误。

尝试指定字体大小: 'wm_font_size' => 40,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM