对于我的页面,我希望用户能够添加图像并自动为图像添加水印。我的代码:
//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'];
如果我运行它,我得到:
严重程度:警告 消息:imagecopymerge()期望参数9为long,给定字符串 文件名:libraries / Image_lib.php 行号:954
但它没有运行回声"错误发生&#34 ;;
我检查了img Image_lib.php 954,它说:
imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity);
所以我检查了wm_opicty的值是什么,它是50
有人可以帮我解决这个错误吗?我也更改了$ config [' wm_opacity'] = 50;至" 50"并尝试完全删除该行,但我仍然得到相同的错误。
答案 0 :(得分:1)
尝试指定字体大小:'wm_font_size' => 40,