如何在Codeigniter中创建图像水印wm_type叠加层?

瓦格勒

我正在尝试将图像放在另一个图像(水印)上,如下所示:

class Water_mark extends CI_Controller {

    function __construct() {
        parent::__construct();
    }

    function index() {
        $this->load->library('image_lib');
        $config['image_library'] = 'GD2';
        $config['source_image'] = '/assets/images/tv-share.jpg';
        $config['new_image'] = '/assets/images/tv-share-done.jpg';
        $config['wm_type'] = 'overlay';
        $config['wm_overlay_path'] = '/assets/images/share_en.jpg';
        $config['wm_opacity'] = '50';
        $config['wm_vrt_alignment'] = 'top'; 
        $config['wm_hor_alignment'] = 'left';
        $config['wm_hor_offset'] = '10';
        $config['wm_vrt_offset'] = '10';

        $data = $config;
        $this->image_lib->initialize($config);

        if (!$this->image_lib->watermark()) {
            echo $this->image_lib->display_errors();
        }
        $this->image_lib->clear();

        $this->load->view('water_mark_view', $data);
    }

}

但我不断收到错误:

A PHP Error was encountered
Severity: Warning
Message: imagecolorat() expects parameter 1 to be resource, boolean given
Filename: libraries/Image_lib.php
Line Number: 941
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
A PHP Error was encountered
Severity: Warning
Message: imagecolortransparent() expects parameter 1 to be resource, boolean given
Filename: libraries/Image_lib.php
Line Number: 953
A PHP Error was encountered
Severity: Warning
Message: imagecopymerge() expects parameter 1 to be resource, boolean given
Filename: libraries/Image_lib.php
Line Number: 954
The path to the image is not correct.
The path to the image is not correct.
The path to the image is not correct.
Your server does not support the GD function required to process this type of image.
Your server does not support the GD function required to process this type of image.
Your server does not support the GD function required to process this type of image.

GD phpinfo

我想念什么?

瓦格勒

问题很简单,就像在开始时就删除正斜杠一样(尽管在文档示例中正斜杠存在):

$config['source_image'] = 'assets/images/tv-share.jpg';
$config['new_image'] = 'assets/images/tv-share-done.jpg';
$config['wm_overlay_path'] = 'assets/images/share_en.jpg';

是什么让我困惑这个错误:

您的服务器不支持处理此类图像所需的GD功能。

当我看到上面的错误时,我从未想过这仅仅是路径问题。

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在带有叠加层的Gridview中创建选定的图像

来自分类Dev

如何在 Android 中创建“始终在顶部叠加层”

来自分类Dev

如何使用CSS创建图像标题和图像叠加层?

来自分类Dev

如何在PDFsharp中添加图像水印?

来自分类Dev

如何在Matlab中在图像上制作部分透明的叠加层?

来自分类Dev

如何在jquery中显示带有叠加层的完整图像?

来自分类Dev

如何在PDF中创建水印

来自分类Dev

如何在引导程序中为模态创建闪亮的中心渐变叠加层?

来自分类Dev

在Dlib中,如何保存带有叠加层的图像?

来自分类Dev

如何在上面有文字的图像上创建一个深色透明叠加层

来自分类Dev

在图像叠加层上创建标题

来自分类Dev

Android:如何使用片段中的浮动RecyclerView创建叠加层

来自分类Dev

如何在html中的叠加层中添加文字?

来自分类Dev

如何在WPF中叠加图像?

来自分类Dev

如何在 CSS 中添加图像叠加

来自分类Dev

如何在Windows中隐藏Firefox相机图标叠加层

来自分类Dev

如何在视频代码中添加按钮叠加层

来自分类Dev

如何在视频标签中添加按钮叠加层

来自分类Dev

如何在活动中创建叠加视图

来自分类Dev

如何在活动中创建叠加视图

来自分类Dev

如何在jQuery中创建叠加形状

来自分类Dev

如何使叠加层适合其他图像

来自分类Dev

如何通过CSS添加图像叠加层?

来自分类Dev

如何关闭叠加层并清除叠加层中的数据?

来自分类Dev

Android图像叠加层中的XML布局

来自分类Dev

如何在YII框架中实现图像水印?

来自分类Dev

如何使用CSS在悬停时创建此透明图像叠加层?

来自分类Dev

如何使用CSS在悬停时创建此透明图像叠加层?

来自分类Dev

如何在WPF中的图像上叠加图像?

Related 相关文章

热门标签

归档