I am trying to produce buttons with
imagecreatefromjpeg(). the problem i am having is i cant allocate a color
for the text of the betton. it appears i have 2 choices black and
gray. Anyone know why this could be. Code is below
<?php Header("Content-Type:
image/jpeg");
switch($buttontype)
{ case 1: $buttonfile = "images/button1.jpg"; break; case 2: $buttonfile = "images/button2.jpg"; break; }
$im =
imagecreatefromjpeg($buttonfile);
switch($color)
{ case 1: $imcolor = imagecolorallocate($im, 255, 0, 0); break; case 2: $imcolor = imagecolorallocate($im, 0, 255, 0); break; case 3: $imcolor = imagecolorallocate($im, 0, 0, 255); break; }
$sizex = imagesx($im); $sizey = imagesy($im); $fontlen = imagefontwidth(3); $strlen = strlen($text) * $fontlen; $xvalue = ($sizex - $strlen)/2; $yvalue = $sizey * .40; imagestring($im, 3, $xvalue, $yvalue, $text, $o);
imagejpeg($im); ?>
Thank You,
Jon Yaggie www.design-monster.com And they were singing . . . '100 little bugs in the code 100 bugs in the code fix one bug, compile it again 101 little bugs in the code 101 little bugs in the code . . .' And it continued until they reached 0 |
- [PHP] Images Jon Yaggie
- [PHP] Images Fernando Avila
- Re: [PHP] Images Hong Zhang
- [PHP] Return Adress Jean-Arthur Silve
- RE: [PHP] Images Matthew Loff
- [PHP] Images PHP List
- Re: [PHP] Images PHP List
- Re: [PHP] Images Joel Boonstra
- [PHP] Images B. Verbeek
- RE: [PHP] Images B. Verbeek
- [PHP] images Craig