Home
      Online Store
      Code Resources Home
      Web Development
      Free Scripts
      Code Snippets
      Resource Links
      Tech Support
      About Us
      Site News
 
GD - Copyright your images, with text
 
This will allow you to add text, center on the image. This way you can copyright your images. Great if you use E-Bay and do not want people to steal the images you took
 
<?php
  
function TagImage ($image$text "Copy Righted"$dest '')
  {
    if ( 
$dest )    
    {         
      
fopen($dest"w") ||
      die(
"Can not write to $dest.  Check directory permissions!");
    } 
    
$imgInfo getimagesize($image);
    switch ( 
$imgInfo[2] )
    {
      case 
1:
        
$im imagecreatefromgif($image);
        
$imgType "gif";
        break;
      case 
2:
        
$im imagecreatefromjpeg($image);
        
$imgType "jpeg";
        break;
      case 
3:
        
$im imagecreatefrompng($image);
        
$imgType "png";
        break;
      default:
        print 
"This Image is not supported!";
        exit;
        break;
    }
    
$font "5"$font_size ImageFontHeight($font); $Width ImageSX($im);
    
$Height ImageSY($im); $X floor($Width 2); $Y $Height 2;
    
$center $X - ((ImageFontWidth($font) * strlen($text)) / 2);
    
$background_color imagecolorallocate ($im255255255);
    
$text_color imagecolorallocate ($im0,0,0);
    
imagefilledrectangle($im,10,$Y,($Width 10),($Y $font_size),$background_color);
    
imagestring($im'5'$center$Y$text$text_color);
    if ( !
$dest ) { header ("Content-type: image/$imgType"); }
    switch ( 
$imgType )
    {
      case 
"gif":
        if (
function_exists(imagegif))
        { 
          if ( 
$dest) { imagegif ($im$dest); } else { imagegif ($im); }
        } else {
          if ( 
$dest) { imagejpeg ($im$dest); } else { imagejpeg($im); }
        }
        break;
      case 
"jpeg":
        if ( 
$dest) { imagejpeg ($im$dest); } else { imagejpeg($im); }
        break;
      case 
"png":
        if ( 
$dest) { imagepng ($im$dest);} else { imagepng($im); }
        break;
    }
    
imagedestroy ($im);
  }
?>



Copyright (c) 2006.
NuOnce Networks, Inc.