Question

For my page i want the user to be able to add images and automaticly add a watermark to the image. My code :

//upload the image 
$this->image_lib->clear();

$this->load->library('image_lib');
$configthumb['image_library'] = 'gd2';

//create the watermark
$configthumb['source_image']    = $_SERVER['DOCUMENT_ROOT'].'/assets/img/design/full/'.$filename;
$configthumb['wm_type'] = 'overlay';
$configthumb['wm_overlay_path'] = './assets/img/watermark/watermark.png';
$configthumb['wm_opacity'] = 50;
$this->image_lib->initialize($configthumb); 

if ( ! $this->image_lib->watermark())
{
    echo $configthumb['source_image'];
    echo $this->image_lib->display_errors();
    echo     "error occured";
}
    echo $configthumb['source_image'];

If i run it i get :

Severity: Warning Message: imagecopymerge() expects parameter 9 to be long, string given Filename: libraries/Image_lib.php Line Number: 954

But it dos not run the echo "error occured";

i checked the img Image_lib.php 954 and it says:

imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity);

so i checked what the value of wm_opicty is and it is 50

Can some one help me solve this error? I also changed $config['wm_opacity'] = 50; to "50" and tryd completely remove the line, but i still get the same error.

Was it helpful?

Solution

Try to specify a font size: 'wm_font_size' => 40,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top