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);
?>

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"); 
?>
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.