PDA

View Full Version : [php]my arrays arent apearing on my image :(



Awkwardsaw
11-25-2009, 09:48 PM
here is my code:

<?php

$b = file_get_contents("Theive_RSC.txt");
$array = explode(";", $b);


header("Content-type: image/png");

function create(){

$im = imagecreate(275, 60);

$bg = imagecolorallocate($im, 138, 138, 138);
$textcolor = imagecolorallocate($im, 255, 0, 0);

imagestring($im, 3, 0, 0, "Awkward Thiever!", $textcolor);
imagestring($im, 3, 0, 15, "Total sleeps: " . $array[0], $textcolor);
imagestring($im, 3, 0, 30, "Total Fights: " . $array[1], $textcolor);
imagestring($im, 3, 0, 45, "Total PickPockets: " . $array[2], $textcolor);
imagepng($im);
imagedestroy($im);
}
create();
?>

and the image:
http://akwardsaw.hostoi.com/Create_Sig_RSC.php

the "array" values should be a string, and they should have actual values, since the value in the .txt is:
13;84;221

it is also chmod 777

what do :(

MylesMadness
11-26-2009, 12:57 AM
could it be that http://akwardsaw.hostoi.com/Theive_RSC.txt is empty?

Awkwardsaw
11-26-2009, 02:01 AM
could it be that http://akwardsaw.hostoi.com/Theive_RSC.txt is empty?

thats odd =o

it doesnt say its empty when i edit/ veiw it, but when i open the actual webpage its empty

wesleyxD
11-26-2009, 06:39 PM
thats odd =o

it doesnt say its empty when i edit/ veiw it, but when i open the actual webpage its empty

http://www.phpcreation.nl/demo.php

here is a demo (http://www.phpcreation.nl/demo.php) changed colours in example

http://www.phpcreation.nl/Theive_RSC.txt

code


<?php

header("Content-type: image/png");

function create(){

$string = file_get_contents("Theive_RSC.txt");
$array = explode(";", $string);

$im = imagecreate(275, 60);
$bg = imagecolorallocate($im, 138, 138, 138);
$textcolor = imagecolorallocate($im, 255, 0, 0);

imagestring($im, 3, 0, 0, "Awkward Thiever!", $textcolor);
imagestring($im, 3, 0, 15, "Total sleeps: " . $array[0], $textcolor);
imagestring($im, 3, 0, 30, "Total Fights: " . $array[1], $textcolor);
imagestring($im, 3, 0, 45, "Total PickPockets: " . $array[2], $textcolor);

imagepng($im);
imagedestroy($im);
}

create();
?>


$string = file_get_contents("Theive_RSC.txt");
$array = explode(";", $string);

has to be inside your function.

Awkwardsaw
11-26-2009, 07:43 PM
<33 thanks! one more thing i know now about PHP :)

Floor66
11-26-2009, 07:43 PM
It's thinggggggg :p You keep doing that

Awkwardsaw
11-26-2009, 07:59 PM
It's thinggggggg :p You keep doing that

wat?

e: o lol... i dont know how :o

rogeruk
11-26-2009, 10:32 PM
Little offtopic,

I used a MySQL database for my script signatures.

SCAR > PHP
PHP > MYSQL
PHP > IMAGE

http://codefanatic.co.uk/stats/php1.gif

Like that :P

Awkwardsaw
11-27-2009, 12:27 AM
Little offtopic,

I used a MySQL database for my script signatures.

SCAR > PHP
PHP > MYSQL
PHP > IMAGE

http://codefanatic.co.uk/stats/php1.gif

Like that :P

i was thinking about using a db, but im still trying to learn file stuff :p
honestly, this works just as fine, the mysql might just be more organised

wesleyxD
11-27-2009, 12:00 PM
i was thinking about using a db, but im still trying to learn file stuff :p
honestly, this works just as fine, the mysql might just be more organised

i can help you if you want just pm me if you need any help.