bugcoder Posted August 30, 2012 Share Posted August 30, 2012 Hi, I am trying to add a transparent watermark on an image. I have a jpg image and I want to write transparent "confidential" on this image. Any kind of direction will be v helpful... Thank you. Link to comment https://forums.phpfreaks.com/topic/267811-transparent-text-on-image/ Share on other sites More sharing options...
Jessica Posted August 30, 2012 Share Posted August 30, 2012 http://lmgtfy.com/?q=php+watermark Link to comment https://forums.phpfreaks.com/topic/267811-transparent-text-on-image/#findComment-1373867 Share on other sites More sharing options...
bugcoder Posted August 30, 2012 Author Share Posted August 30, 2012 well i was already searching in google however here is what i could finally get from my research <?php $watermark = imagecreatefrompng('transparent.png'); //image written "confidential" in it with grey color and white bg $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg("photo.jpg"); //photo on which watermark needs to be written $size = getimagesize("photo.jpg"); $dest_x = $size[0] - $watermark_width - 175; $dest_y = $size[1] - $watermark_height - 45; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 50); imagejpeg($image,'new_image.jpg'); //uncomment the following two lines if you want to see result directly in browser or use the above line to get the file in directory. //header('content-type: image/jpeg'); //imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> Link to comment https://forums.phpfreaks.com/topic/267811-transparent-text-on-image/#findComment-1373962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.