RE: voucher manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> Alo,
> 
> I have a client looking to do the following;
> 
> There is a standard "voucher" design, in the format of JPG 
> ... now ... they
> wish to create a voucher system where if you reach so many 
> points etc you
> can claim a voucher (using the design) with a expiry date ... 
> current +
> 30days and a unique voucher number.
> 
> Now, I have looked at ImageCreateFromjpeg etc ... but ... 
> cant figure out
> how to place the text on it within the specified areas. It 
> will then be
> emailed to the user.
> 
> Does anyone know of an idea out there already I can take a 
> look at ... or
> some advice?
> 

Steven,

Have a look at http://php.net/imagettftext . Also, here is a code snippet
from something I did a long time ago to brand uploaded images.  Maybe you
can modify it for your needs or get an idea of how to proceed.  It contains
two slightly offset imagettftext() calls because I wanted a "drop shadow"
effect to the brand. 


-------------[code]---------------

$fontpath			=$_SERVER['DOCUMENT_ROOT']."/PAPYRUS.TTF";

function brand_image($big_pic){
// Draw border and brand big_pic
	$ims=getimagesize($big_pic);
	$img = ImageCreateTrueColor($ims[0],$ims[1]);
	$black = imagecolorallocate ($img, 0, 0, 0);
	$white = imagecolorallocate ($img, 255, 255, 255);
	imagecopy($img,$org_img, 0, 0, 0, 0, $ims[0], $ims[1]);
	
for($x=0;$x<$tnborderwidth;$x++){imagerectangle($img,$x,$x,$ims[0]-(1+$x),$i
ms[1]-(1+$x), $black);}
	imagettftext($img,20, 0, $ims[0]-260, $ims[1]-20, $black, $fontpath,
$brandtext);
	imagettftext($img,20, 0, $ims[0]-262, $ims[1]-22, $white, $fontpath,
$brandtext);
	imagejpeg($img,$big_pic,90);
	imagedestroy($img);
} //function brand_image

--------------[/code]---------------

JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux