用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2846|回复: 0
收起左侧

CI 多张图片水印的问题,

[复制链接]
发表于 2014-1-14 11:53:51 | 显示全部楼层 |阅读模式
我尝试着用CI的Watermark 功能,添加水印,但是循环处理多张图片的时候,发现,水印的位置不唯一,求解释,,,,求帮助....
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
        public function __construct(){
                parent::__construct();
        $this->load->library('image_lib');
                $this->load->helper('directory');
         }  
        public function index()
        {   
                $this->load->view('welcome_message');
               
                $name=directory_map('./public/gq/');
                $lev=count($name);
                $vrt=20;
            foreach($name as $key => $filename){
                        $url='public/gq/'.$filename;
                        $lev=$lev-1;
                        $this::showpic($url,0);
                        for($j=0;$j<=100;$j++){}
                        echo $filename."watermarked ok"."====>"."file leaves ".$lev."<br />";        
                }
        }
        public function showpic($url,$vrt){
                                $config['source_image'] = $url;
                                $config['wm_text'] = '华宝佛经网:http://hbfjw.org';                                
                                $config['wm_type'] = 'text';
                                $config['wm_font_path'] = './system/fonts/STKAITI.TTF';
                                $config['wm_font_size'] = '326';
                                $config['wm_font_color'] = 'e49955';
                                $config['wm_vrt_alignment'] = 'bottom';
                                $config['wm_hor_alignment'] = 'LEFT';
                                $config['quality']='50';
                                $config['wm_shadow_color']='1b2260';                                
                                $this->image_lib->initialize($config);
                                $this->image_lib->watermark();
                                
        }

}

本版积分规则