Techmate Posted August 2, 2011 Share Posted August 2, 2011 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! Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 2, 2011 Share Posted August 2, 2011 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); ?> Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 2, 2011 Author Share Posted August 2, 2011 I have a watermark already I created I am just have a problem uploading it into the database. Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 2, 2011 Share Posted August 2, 2011 1. copy code 2. paste in you file 3. place file on server 4. execute through browser 5. post results here Quote Link to comment Share on other sites More sharing options...
gizmola Posted August 2, 2011 Share Posted August 2, 2011 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. Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 2, 2011 Author Share Posted August 2, 2011 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. Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 2, 2011 Share Posted August 2, 2011 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. Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 2, 2011 Author Share Posted August 2, 2011 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"); ?> } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.