GD & & MySQL Problem
Posted: Wed Jun 15, 2005 12:16 pm
Couldn't figure out which room this is more relevant in, so i placed it in here.
I 'used' to have an image produced using this code below, but my server changed to GD 2.x on there servers, and the code no longer works. Could you please help me figure out why please
I 'used' to have an image produced using this code below, but my server changed to GD 2.x on there servers, and the code no longer works. Could you please help me figure out why please
Code: Select all
<?php
$conn = mysql_connect("localhost","***","***");
mysql_select_db("***",$conn);
$sql = "SELECT * FROM counter WHERE section = 'dframe'";
$result = mysql_query($sql,$conn) or die(mysql_error());
while ($r = mysql_fetch_array($result)) {
$id = $r['id'];
$counth = $r['counth'];
}
$sql = "UPDATE counter SET counth = counth + 1 WHERE section = 'dframe'";
$result = mysql_query($sql,$conn) or die(mysql_error());
header ("Content-type: image/png");
$im = imagecreate(35,13);
//Here are some common color codes in case you want to change the colors.
$black = imagecolorallocate ($im,0x00, 0x00, 0x00);
$white = imagecolorallocate ($im,0xFF, 0xFF, 0xFF);
$black3 = imagecolorallocate ($im,0x69, 0x69, 0x96);
$black4 = imagecolorallocate ($im,0x69, 0x69, 0x96);
imagefilledrectangle($im, 0, 0, 450, 23, $black);
$font = 'verdana.ttf';
imagettftext($im, 7, 0, 2, 10, $white, $font, $counth);
imagepng ($im);
imagedestroy ($im);
?>