【问题标题】:Call to a member function watermark() in codeigniter在 codeigniter 中调用成员函数 watermark()
【发布时间】: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


【解决方案1】:

查看文档后,它使用:
$config['source_image'] 而不是$config['source_img']

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-10
    • 2021-01-23
    • 2017-06-18
    • 2011-12-23
    相关资源
    最近更新 更多