【发布时间】:2014-07-18 18:45:42
【问题描述】:
我正在尝试将图像放在另一个图像(水印)上,如下所示:
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.
我错过了什么?
【问题讨论】:
标签: php codeigniter image-processing watermark