|
Posted by The Doctor on 01/10/06 01:17
I get a customer that has the following code
that needs to run:
<?
Header("Content-Type: image/gif");
if(isset($_GET['BTT'])){
$BTT = $_GET['BTT'];
}
else{
$BTT = "";
}
$insert = imagecreatefromgif("MenuButton3.gif");
$text=$BTT;
$font="/Fonts/verdanab.ttf";
// calculate position of text
$tsize = ImageTTFBBox(10,0,$font,$text);
$dx = abs($tsize[2]-$tsize[0]);
$dy = abs($tsize[5]-$tsize[3]);
$x = ( ImageSx($insert) - $dx ) / 2;
$y = ( ImageSy($insert) - $dy ) / 2 + $dy;
//choose textcolor (black)
$col=ImageColorAllocate ($insert, 0, 0, 0);
$black = imagecolorallocate($insert, 0, 0, 0);
$grey = imagecolorallocate($insert, 128, 128, 128);
//center text
//work out how big the text is
$bounds = imagettfbbox(10,0,$font,$text);
//get width - right x coord - left x coord
$textwidth = $bounds[2] - $bounds[0];
//get offset
$textoffset = $textwidth / 2;
//calc start pos - half the image size minus offset - middle of image should be middle of text.
$textstartpos = (imagesx($insert)/2) - $textoffset;
// imagettftext ($insert, 10, 0,$textstartpos, 21, $grey $font, $text);
imagettftext ($insert, 10, 0,$textstartpos, 18, $black, $font, $text);
imagegif($insert,"",100);
imagedestroy($insert);
?>
Here is my php config:
configure --prefix=/usr/contrib --localstatedir=/var \
--infodir=/usr/share/info \
--mandir=/usr/share/man --with-low-memory --with-elf --with-x \
--with-mysql=/usr/contrib --with-zlib --enable-track-vars \
--enable-versioning --with-config-file-path=/usr/contrib/lib \
--with-gd --enable-ftp --with-openssl=/usr/contrib \
--with-jpeg-dir=/usr --with-pgsql=/usr/contrib/pgsql \
--with-png-dir=/usr --with-zlib-dir=/usr \
--with-xpm-dir=/usr/X11R6 --with-libxml-dir=/usr/contrib/ \
--with-freetype-dir=/usr/X11R6 --with-tsrm-pthreads --enable-mbstring \
--enable-imap --with-bz2 --with-apxs2=/usr/contrib/bin/apxs
What am I missing?
--
Member - Liberal International
This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
God Queen and country! Beware Anti-Christ rising!
Canada : Consider carefully whom to vote for on 23 Jan 2006, I choose Liberal!
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Navigation:
[Reply to this message]
|