Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Problem with Watermarking and Overlay
#1

[eluser]eakroko[/eluser]
Hi,

just a little example to explain my problem:
i have an image with 1024x768px. I would like to watermark that image with a submitted text.
That text needs to be below the image.
Actually is not really overlaying, more like expanding the image.
So I thought I can just create an image with the original dimensions+15px height (with bgc white).
Then I put the Original Image above the created white image. The expanded 15px height are now white at the bottom.
That is working fine, and also the text watermarking. But some Pixels are afterwards just white.

There might be really a better solution but I'm just stuck at that point..

I will show you an example picture how it looks originally and after overlaying.

Original Image: http://img716.imageshack.us/f/jellyfishao.jpg/
Copyright Image: http://img146.imageshack.us/i/jellyfisho.jpg/

As you can see, the copyrighted image is higher but those white pixels are annoying -.-


Code:
public function test($url, $cr, $fontsize=11){
        $size = getimagesize(base_url()."uploads/bild/".$url);
        $breite = $size[0];
        $hoehe = $size[1];
        $im = imagecreatetruecolor($breite, $hoehe+15);
        imagefill($im,0,0,0x00FFFFFF);
        imagejpeg($im, "./uploads/tmp/".$url);
        imagedestroy($im);
        
        $config['source_image'] = "./uploads/tmp/".$url;
        $config['wm_type'] = 'overlay';
        $config['wm_vrt_alignment'] = 'top';
        $config['wm_hor_alignment'] = 'left';
        $config['wm_overlay_path'] = "./uploads/bild/".$url;
        $config["create_thumb"] = FALSE;
        $config["wm_opacity"] = 100;
        
        $this->load->library("image_lib",$config);
        
        if(!$this->image_lib->watermark()){
             die($this->image_lib->display_errors());
        }
        
        $this->image_lib->clear();


        $config['source_image'] = "./uploads/tmp/".$url;
        $config['wm_text'] = $cr;
        $config['wm_type'] = 'text';
        $config['wm_font_path'] = './system/fonts/tahoma.ttf';
        $config['wm_font_size'] = $fontsize;
        $config['wm_font_color'] = '000000';
        $config['wm_vrt_alignment'] = 'bottom';
        $config['wm_hor_alignment'] = 'left';
        $config['wm_padding'] = '3';
        $config["thumb_marker"] = "";
        $config["create_thumb"] = FALSE;
        
        $this->image_lib->initialize($config);
        
        if(!$this->image_lib->watermark()){
             die($this->image_lib->display_errors());
        }
        $this->image_lib->clear();
        
        rename("./uploads/tmp/".$url,"./uploads/bild/".$url);
        return TRUE;
    }

Thank you if u can help me.

eakroko
#2

[eluser]eakroko[/eluser]
Ok, I got it working.
I didnt use the lib from CI and solved it with simple imagecopy.

greetings




Theme © iAndrew 2016 - Forum software by © MyBB