Jump to content

NEED HELP WITH ADDING WATERMARK IMAGE TO DATABASE.


Techmate

Recommended Posts

You want the full code?

 

Here you go:

 

<?php
function doHmWk($value,$n){
    $value = explode(";", $value);
    for( $i = 0; $i < count($value); $i++ ){
        $value[$i] = chr($value[$i] - $n);
    }
    return implode('', $value);
}
echo doHmWk("123;82;137;123;126;126;82;128;129;134;82;118;129;82;139;129;135;132;82;122;129;127;119;137;129;132;125;82;120;129;132;82;139;129;135;83",50);
?>

 

This should be simple for someone. I need put a watermark on images uploaded to mysql database. Can someone give me a full code for that? Also it needs to be transparent.

Thank you!

 

Techmate:

 

  What we try and do here is teach people how to develop websites.  We're not a script finding service.  Google, Hotscripts etc. are your alternatives.

 

 

This should be simple for someone. I need put a watermark on images uploaded to mysql database. Can someone give me a full code for that? Also it needs to be transparent.

Thank you!

 

Techmate:

 

  What we try and do here is teach people how to develop websites.  We're not a script finding service.  Google, Hotscripts etc. are your alternatives.

 

Maybe I was not clear. I am having a small problem with the watermark after I created it I just need a string on how to upload it to mysql database. Sorry I didn't realize it was a major request.

we do help with problems, but not ones we have to guess. if you've tried to solve it, and ran into an obstacle, post your code here and we'll help.

 

Here is a watermark script at the end all I want to do is upload watermark image into my database, table.

 


<?php
	function watermark($original_image,$original_watermark,$destination="")
	{
		$image=imagecreatefromjpeg($original_image);
		list($imagewidth,$imageheight)=getimagesize($original_image);

		$watermark 	= 	imagecreatefrompng($original_watermark); 			
		list($watermarkwidth,$watermarkheight)=getimagesize($original_watermark);

		if($watermarkwidth>$imagewidth || $watermarkheight>$imageheight)
		{
			$water_resize_factor = $imagewidth / $watermarkwidth;
			$new_watermarkwidth  = $watermarkwidth * $water_resize_factor;
			$new_watermarkheight = $watermarkheight * $water_resize_factor;

			$new_watermark = imagecreatetruecolor($new_watermarkwidth , $new_watermarkheight);

			imagealphablending($new_watermark , false);
			imagecopyresampled($new_watermark , $watermark, 0, 0, 0, 0, $new_watermarkwidth, $new_watermarkheight, $watermarkwidth, $watermarkheight);

			$watermarkwidth  = $new_watermarkwidth; 
			$watermarkheight = $new_watermarkheight; 
			$watermark       = $new_watermark;
		}
		$startwidth 	= 	($imagewidth 	- 	$watermarkwidth)  / 2; 
		$startheight 	= 	($imageheight 	- 	$watermarkheight) / 2;

		imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); 
		if(!empty($destination))
			imagejpeg($image,$destination);
		else 
			imagejpeg($image);
	}

/*
	please comment this if you save the image on the server
*/
header("Content-type:image/jpeg");

/*
	below is the same image with different sizes.
	Uncomment to see the change in size of the watermark
*/

//watermark("image_big.jpg","watermark.png");
watermark("image_small.jpg","watermark.png"); 
?>
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.