关于图片加水印
本帖最后由 xiehc 于 2009-8-25 13:45 编辑我的程序是从实例中复制的
public function index()
{
$config['source_image'] = '/data/www/test/uploadfile/12511009781.jpg';
$config['wm_text'] = 'Copyright 2006 - John Doe';
$config['wm_type'] = 'text';
$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();
echo $this->image_lib->display_errors();
}
但是运行后加完水印的图片去那找呢?请问加完水印的图片如何调用呢 ,请高手指教 $config['source_image'] = '/data/www/test/uploadfile/12511009781.jpg';
未设置生成新文件,水印直接加在源文件上 当$config['create_thumb']等于FALSE并且$config['new_image']没有指定时,会调整原图的大小
当$config['create_thumb']等于TRUE并且$config['new_image']没有指定时,生成文件名为(原图名_thumb.扩展名)
当$config['create_thumb']等于FALSE并且$config['new_image']指定时,生成文件名为$config['new_image']的值
当$config['create_thumb']等于TRUE并且$config['new_image']指定时,生成文件名为(原图名_thumb.扩展名) 我这个看教程也没加上。。郁闷滴 看一下有没有报错,目录有没有权限。 改用图片加吧,用文字加有时显示不出.
$config['image_library'] = 'GD2';
$config['source_image'] = $upload['full_path'];//包括文件名的原文件路径
$config['dynamic_output'] = FALSE;
$config['quality'] = '90%';
$config['wm_type'] = 'overlay';
$config['wm_padding'] = '0';
switch ($this->setting['watermark_pos']['value'])//贴水印方位
{
case 1:
$config['wm_vrt_alignment'] = 'top';
$config['wm_hor_alignment'] = 'left';
break;
case 2:
$config['wm_vrt_alignment'] = 'top';
$config['wm_hor_alignment'] = 'center';
break;
case 3:
$config['wm_vrt_alignment'] = 'top';
$config['wm_hor_alignment'] = 'right';
break;
case 4:
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'left';
break;
case 5:
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
break;
case 6:
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'right';
break;
}
$config['wm_overlay_path'] = '水印图片路径';//$this->setting['watermark_path']['value'];//水印图像的名字和路径
$config['wm_opacity'] = 50;//$this->setting['watermark_trans']['value'];//水印图像的透明度
$config['wm_x_transp'] = '4';//水印图像通道
$config['wm_y_transp'] = '4';//水印图像通道
$this->image_lib->initialize($config);
$this->image_lib->watermark();
$this->image_lib->clear(); :'( 我这图片也印不上啊。产生新图了都!
$this->load->library('image_lib');
$this->load->helper('html');
$img_dr = 'system/dogwin/images/zm.jpg';
$config['source_image'] = $img_dr;
//$config['wm_text'] = 'DogWin';
$config['create_thumb'] = TRUE;
$config['wm_type'] = 'overlay';//text
$config['wm_padding'] = '0';
//$config['wm_font_path'] = 'system/fonts/texb.ttf';
//$config['wm_font_size'] = '20';
//$config['wm_font_color'] = 'FF1438';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'right';
//$config['wm_padding'] = '20';
$config['wm_overlay_path'] = 'system/dogwin/images/top.jpg';
$config['wm_opacity'] = 10;
$config['wm_x_transp'] = '4';//水印图像通道
$config['wm_y_transp'] = '4';//水印图像通道
$config['show_image'] = img($img_dr);
$this->image_lib->initialize($config);
$this->image_lib->watermark();
$this->image_lib->clear();
//show
$this->load->view('print_image',$config,FALSE); 看一下是不是字体问题? 字体有什么问题?我也加不上文字
页:
[1]