首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >codeigniter缩略图已创建,但原始图像存在问题

codeigniter缩略图已创建,但原始图像存在问题
EN

Stack Overflow用户
提问于 2011-06-16 08:53:56
回答 1查看 842关注 0票数 1

我有下面的代码,如果我不使用水印,这是很好的,但当我使用水印时,原始图片和缩略图都变得非常小,水印发生在缩略图上,我想在原始图像上添加水印,请帮助

代码语言:javascript
复制
//UPLOAD IMAGE
        //some $config vars for image
        $config['upload_path'] = './images/blog';
        $config['allowed_types'] = 'gif|jpg|jpeg|png';
        $config['max_size'] = '0';
        $config['remove_spaces'] = true;
            $config['overwrite'] = false;
            $config['max_width'] = '0';
            $config['max_height'] = '0';

            $this->load->library('upload', $config);

            //upload main image
            if(!$this->upload->do_upload('photo')){
                $e = $this->upload->display_errors();
                print_r($e);
            }

            $image = $this->upload->data();


    //thumbnail creation start
            $config1['image_library'] = 'gd2';
            $config1['source_image'] = $image['full_path'];
            $config1['create_thumb'] = TRUE;
            $config1['maintain_ratio'] = TRUE;
            $config1['width'] = 75;
            $config1['height'] = 50;

            $this->load->library('image_lib', $config1);
            $this->image_lib->resize();
            //thumbnail creation ends


        $this->image_lib->clear();
        //$image = $this->upload->data();
        //start watermarking
        $config2['source_image'] = $image['full_path'];
        $config2['wm_text'] = 'Copyright 2011 myself';
        $config2['wm_type'] = 'text';
        $config2['wm_font_path'] = './system/fonts/FromWhereYouAre.ttf';
        $config2['wm_font_size'] = '16';
        $config2['wm_font_color'] = 'ffffff';
        $config2['wm_vrt_alignment'] = 'middle';
        $config2['wm_hor_alignment'] = 'center';
        $config2['wm_padding'] = '20';

        $this->load->library('image_lib');
        $this->image_lib->initialize($config);
        $this->image_lib->watermark();
        //end watermarking
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-06-16 18:12:54

请尝试添加

代码语言:javascript
复制
        $config2['new_image'] = '';

在水印代码中

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6366031

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档