Login   Register  
PHP Classes
elePHPant
Icontem

File: graphic.php3

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of kris kumler  >  TriImage  >  graphic.php3  >  Download  
File: graphic.php3
Role: ???
Content type: text/plain
Description: file to call image overlay, demonstrates basic methods; outputs image/gif
Class: TriImage
Author: By
Last change:
Date: 14 years ago
Size: 1,246 bytes
 

Contents

Class file image Download
<?
Header( "Content-type: image/gif");
/***********************************************************
Demonstration file for TriImage class
by Kris Kumler
--not much functionality right now, but is the basis for a future
revision in the works.  Will allow for easy placement of text on
graphics for watermarking, etc.  This will all be reduced to only a 
few lines to use :)
***********************************************************/
include( 'triImage.php3 ');

	$triImage = new TriImageClass;
		
        $string = "This image is not licensed\n\rfor public use. (c) US";
        
        $fontSize = 24;
        $font = "fonts/times.ttf";
        
        $im = imagecreatefromgif("first.gif");
        
        $black = ImageColorAllocate($im,0,0,0);
	$red = ImageColorAllocate($im,230,0,0);
        
	$tw = $triImage->getTextWidth($font,$fontSize,0,$string);
	$px = $triImage->getTextxPos($im,$tw);
	
	$th = $triImage->getTextHeight($font,$fontSize,0,$string);
	$py = $triImage->getTextyPos($im,$th);
        
        ImageTTFText($im,$fontSize,0,$px+1,$py+1,$black, $font, $string);
        ImageTTFText($im,$fontSize,0,$px,$py,$red, $font, $string);
	
        ImageGif($im); 
        ImageDestroy($im); 
?>