每当我为图像添加水印时,它会将背景变为黑色,jst知道这是否是一个错误,如果没有可以做的改变它
答案 0 :(得分:0)
仔细检查user_guide图像库,实际上是在水印部分,这个问题随我而去,我从user_guide解决了..你的水印图像应该至少有一个透明点,所以你可以指定为发布水印后需要透明的颜色,请查看此示例:
$image_cfg = array();
$image_cfg['image_library'] = 'GD2';
$image_cfg['source_image'] = '--HERE THE PATH TO IMAGE THAT WILL TAKE WATERMARK--';
$image_cfg['wm_overlay_path'] = '--HERE THE PATH TO THE WATERMARK IMAGE ITSELF--';
$image_cfg['new_image'] = '--HERE THE PATH TO SAVE THE NEW IMAGE AFTER WATERMARK--';
$image_cfg['wm_type'] = 'overlay';
$image_cfg['wm_opacity'] = '99';
$image_cfg['wm_x_transp'] = 200;
$image_cfg['wm_y_transp'] = 200;
$image_cfg['wm_vrt_alignment'] = 'top';
$image_cfg['wm_hor_alignment'] = 'left';
$image_cfg['create_thumb'] = FALSE;
$this->image_lib->initialize($image_cfg);
$this->image_lib->watermark();
$this->image_lib->clear();
注意wm_x_transp和wm_y_transp的一部分...这两个部分分配像素的x和y,使其颜色在最终结果中透明,默认为4,4,我认为这个像素在你的情况不透明,试试这个答案就行了