Rodrigo, I've been struggling with this for some time, so here goes: The php4 builds do not support .gif files, you'll need to change your files to .jpg or .png format, or use php3 (I can't change to php3).
I use imagecreate() func. before imagecreatefromjpeg() func. because if I didn't do this, the added text would be gray regardless of the desired color. The mysql portion is solid and yields the desired results. However, I'm having trouble with something related to the imagecreatefromjpeg() func., I get a server error (500) on some images regardless of their size. This is the only error produced by the func. and it is maddening. From experimentation, I believe that there's something wrong with the .jpg files, the .jpg file upload, or the phase of the moon. Good luck, Hugh <?php header("content-type: image/jpg"); $font="fonts/arial.ttf"; $font2="fonts/wingding.ttf"; $im_size = GetImageSize("$image_file"); $imWidth = $im_size[0]; $imHeight = $im_size[1]; $image=ImageCreate($imWidth,$imHeight); $black=imagecolorallocate($image,0,0,0); $white=imagecolorallocate($image,255,255,255); $red=imagecolorallocate($image,255,100,100); $orange=imagecolorallocate($image,255,200,0); $yellow=imagecolorallocate($image,233,233,0); $green=imagecolorallocate($image,80,255,80); $lt_blue=imagecolorallocate($image,180,180,255); $blue=imagecolorallocate($image,120,120,255); $dk_blue=imagecolorallocate($image,0,0,200); $purple=imagecolorallocate($image,200,100,200); $brown=imagecolorallocate($image,190,160,150); $image2=imagecreatefromjpeg("$image_file"); imagecopy ($image, $image2, 0, 0, 0, 0, $imWidth, $imHeight); $db="data_base_name"; $pass="password"; $link=mysql_connect("localhost","","$pass"); if (! $link) die("Can't log in at this time"); mysql_select_db($db,$link) or die ("Can't log in at this time"); $query="mysql query "; $results=mysql_query($query); if (!$results) die(mysql_error()); mysql_close($link); while ($landmark=mysql_fetch_array($results)) { $coordinate_x=$landmark['x']; $coordinate_y=$landmark['y']; $plant=$landmark['plant']; if ($plant=="flowering") $var_color=$red; if ($plant=="conifer") $var_color=$orange; if ($plant=="palm") $var_color=$yellow; if ($plant=="other") $var_color=$lt_blue; imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $black, $font2, "l"); imagettftext($image, 19, 0,$coordinate_x-7, $coordinate_y+4, $black, $font2, "l"); imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $black,$font2,"l"); imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $var_color, $font2, "l"); imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $white, $font2, "l"); } imagejpeg($image,"./new/$image_file",100); ImageDestroy($image); ImageDestroy($image2); header("location: finished.php"); ?> ----- Original Message ----- From: "Rodrigo Peres" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Saturday, February 16, 2002 11:49 AM Subject: [PHP] Change gif image with php > Hi list > > I have some buttons made in photoshop in .gif format. This buttons have > round corner, feather, multiple colors etc. There's a way to open it with > php and write some text to it. I know that is possible to create images, but > what about to change them??? I need to do this because the text that will > fill the buttons come from mysql and change everyday. > > Thank's in advance > > > Rodrigo > > > ps: If someone want to see the button I'm talking look in > http://www.celebnet.com.br/home.php under the "AS ++". > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php