【发布时间】:2017-12-08 11:17:52
【问题描述】:
我需要为现有图像添加水印。 Codeigniter 在 image_lib 库下提供了这样的功能。根据here 给出的指令,我已经完成了。显示的是致命错误而不是结果。
遇到 PHP 错误
严重性:错误
消息:在 null 上调用成员函数 watermark()
文件名:控制器/Imageman.php
行号:22
代码是
$config['image_library'] = 'gd2';
$config['source_img']='images/images.jpg';
$config['wm_text']='Hi welcome..!';
$config['wm_type']='text';
$config['wm_font_path']='./system/fonts/texb.ttf';
$config['wm_font_size']='16';
$config['wm_font_color']='ffffff';
$config['wm_vrt_alignment']='bottom';
$config['wm_hor_alignment']='center';
$config['wm_padding']='20';
$this->load->library('Image_lib',$config);
$this->Image_lib->watermark();
if($this->Image_lib->watermark())
{
echo "Watermark added";
}
else
{
echo "Failed";
}
【问题讨论】:
-
使
Image_lib小写,$this->load->library('image_lib', $config);和$this->image_lib->watermark()。
标签: codeigniter