проблем с createimagefromgif

Dido_net

Registered
значи, ползвам кода на jooroo за уебкаунтър, искам да направя да ми записва резултата върху картинка.. ето кода:

<?php
$img=$_GET['img'];
$referer = $_SERVER['HTTP_REFERER'];
$id = intval($_GET['id']);

$counters=array(
"1"=>
"R0lGODlhWAAfAPcAAAAAAP///4a+/2Wt/1OV30yf/keK2EOa/D6E0z2W+jmT+DeR9jWP9DON8jCL8C6I7SyG6ymD6AZgxQhhxwpjyQpjxwxlywxlyA5ozQ9nzA5lxxBqzw9nyhFqzhFpzhNs0BVv1BVu0hdx1hdtzhp02Rpz1xlv0Rpw0hx22xx12Bxy1B101h953h532x922CJ84SR+4yN73yN63CZ/4yV83SJyzSeB5iV73CiC5ih+4CqD6CmA4Sh72iuF6SuE5yd51Cp93C6H7C2H6y2F6SyC5CuA3yp92y+I7S6G6Sx/3jCJ7i+F6C6F5S2B3zGM8DGL8DGK7jCG6C+C4TON8TKJ6y5/2jSN8jaP9DaP8zWO8jKF4zeQ9DaN7zWL7TOG5TB91C960DiR9jiR9TOE4DqT+DmS9jaK6DSG4TOC2juU+DqT9zmP8TaI5jyV+DqR8ziM6jyT9DeH4T6X+j6U9j2S8TuO7DiH4ECY+z+W+D6S8T2R70GY+UCX+D+T8kKY+T2P6UGV80Sb/D6N5jqC1UWb+0OX9UCQ6kWY9z6K30eb+UWX9ESV8DyC0zuC0UKP5T2D1Emc+j6E1D2E00qe/D+G1kiY8kCG1T+F1E2f/kyf/EeV7EOM3kGI2EGH106g/kaQ5EOK2kKI2EKH10OK2UKH1VCh/USK2VGi/keO3kaM20WL2kmR4kiP30eN3UmQ302X6kqR4UqQ30eL2EyT40uS4UiL2E2U40yS4EqO20qN20mN2Vel/lOe806V5U6U40yQ3kuO3E+W5UyQ3VGY506T4E6T306R31Sb7VKZ6FKZ51GX5lSb6lOa6VGV4leh8lad7VWc61Sa6Vac7Fac61OY5FOX5FKU31ab51aa51WZ5Vmf7Vmd61SV31mc6lic6Fib5laX4laY4VWW31ug7F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JHUh00UMPOugQwdlop6322my37fbbbw/RRR5F+cOPPvfcww4vldD/kUceffShyBFBCAHB4YgnrvjijDfu+OOQH8FFH0Xp48wiXTygueZHHKEEFGtAoUTnm5du+umop6766qxrDjogA8xTiBtTOGD77U844cQUtOv+xO3ABy/88MQXb/zxtvNeCFqHwIFFAx9bYUUWDMDBQBbSN6D99tx37/334IcvvvhYwHEIWonMIQYDAzDg/gBXXLHFFnPMH7/7+Oev//789+///wAUwxwSgT48qGEBA1iAAgcQhjCUoQx8eGADFUjBClrwghjMoAY3yEE14IGAA4DEHtqggAEo4IQDIAMZ0pAGP7BQhSeMoQxnSMMa2vCGOMxhG/YACbRkghB3SMDHbBIghyISoohySIASl8jEJjrxiVCMohSneAdCZAItpZhEIA7AxS5yMRCB0OIWvUjGMprxjGhMoxrLGMZSoGUXp/BEAeZIxzliAhOnuGMd98jHPvrxj4AMZB89cYpdfOyQiEykIhfJyEY6MpEBAQA7"
);
if($img=="1") {
header("Content-type: image/gif");
echo base64_decode($counters[1]);
exit;
}


if(!@include ("config.php"))
{echo"<h1>Error 100</h1> report to administrator";exit;}


$query = mysql_query("SELECT * from $table where id=$id");
if(mysql_num_rows($query) != 0) {
while($rows = mysql_fetch_array($query))
{
$rows[1]++;
$referer_sql=$rows[3].",".$referer;
$query2 = mysql_query("UPDATE $table SET count = '$rows[1]', referer = '$referer_sql' where id='$id'");
$number = $rows[1];
}
header("Content-type: image/gif");
$im = imagecreatefromgif("?img=1");
$font = "visitor2.ttf";
$black = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 1, 0, 10, 13, $black, $font, $number);
imagegif($im);
imagedestroy($im);

}

if(mysql_num_rows($query) == 0)
{
echo "Невалидно ID !";
}

?>

но имам някъв проблем.. дава тоя ерор:

<br />
<b>Warning</b>: imagecreatefromgif(?img=1) [<a href='function.imagecreatefromgif'>function.imagecreatefromgif</a>]: failed to open stream: Invalid argument in <b>C:\AppServ\www\counter\new\new.php</b> on line <b>31</b><br />
<br />
<b>Warning</b>: imagecolorallocate(): supplied argument is not a valid Image resource in <b>C:\AppServ\www\counter\new\new.php</b> on line <b>33</b><br />

<br />
<b>Warning</b>: imagettftext() expects parameter 1 to be resource, boolean given in <b>C:\AppServ\www\counter\new\new.php</b> on line <b>34</b><br />
<br />
<b>Warning</b>: imagegif(): supplied argument is not a valid Image resource in <b>C:\AppServ\www\counter\new\new.php</b> on line <b>35</b><br />
<br />

<b>Warning</b>: imagedestroy(): supplied argument is not a valid Image resource in <b>C:\AppServ\www\counter\new\new.php</b> on line <b>36</b><br />
 
Проблема според мен идва от тук $im = imagecreatefromgif("?img=1"); не задава правилно пътя към картинката а тя трябва да е задължително gif
 
ами.. зададох пълния адрес към картинката и се оправи.. а как да го направя без да задавам пълен адрес.. etc? :roll:
 
header("Content-type: image/gif");
$im = imagecreatefromgif("?img=$img");
$font = "visitor2.ttf";
$black = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 1, 0, 10, 13, $black, $font, $number);
imagegif($im);
imagedestroy($im);

така присвояваш img от GET
 

Горе