you are here: codestackercodes [RSS] → tag watermark [RSS]

watermark

function watermark($imagesource){
	$filetype = substr($imagesource,strlen($imagesource)-4,4); 
	$filetype = strtolower($filetype); 
	if($filetype == ".gif")  $image = @imagecreatefromgif($imagesource);  
	if($filetype == ".jpg")  $image = @imagecreatefromjpeg($imagesource);  
	if($filetype == ".png")  $image = @imagecreatefrompng($imagesource);  
	if (!$image) die(); 
	$watermark = @imagecreatefrompng('../images/watermark.png'); 
	$imagewidth = imageSX($image); 
	$imageheight = imageSY($image);  
	$watermarkwidth =  imageSX($watermark); 
	$watermarkheight =  imageSY($watermark); 
	$startwidth = $imagewidth - $watermarkwidth - 5;  
	$startheight = $imageheight - $watermarkheight - 5;
	imagecopy($image, $watermark,  $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); 
	imagejpeg($image,$imagesource);
	imagedestroy($image); 
	imagedestroy($watermark);
}
Displaying 1 Code