Jump to content

transparent text on image


bugcoder

Recommended Posts

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

?>

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.