开发者

codeigniter thumbnail created but original image problem

I have the code below, if i don't use watermark it's fine but when i use watermark, both the original pics and thumbnail become very small and , watermark happens on thumbnail, I want watermark on the original image, pls help

//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


please try adding

        $config2['new_image'] = '';

in the watermarking code

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜