SRL Archive - General

[php]my arrays arent apearing on my image :(


Awkwardsaw

2009-11-25 16:48:01

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:

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

2009-11-25 19:57:19

could it be that http://akwardsaw.hostoi.com/Theive_RSC.txt is empty?

Awkwardsaw

2009-11-25 21:01:42

From: MylesMadness
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

2009-11-26 13:39:06

From: Awkwardsaw
thats odd =o

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



here is a demo changed colours in example

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

code

[PHP]<?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();
?>
[/PHP]

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

has to be inside your function.

Awkwardsaw

2009-11-26 14:43:00

<33 thanks! one more thing i know now about PHP :)

Floor66

2009-11-26 14:43:37

It's thinggggggg :p You keep doing that

Awkwardsaw

2009-11-26 14:59:57

From: Floor66
It's thinggggggg :p You keep doing that


wat?

e: o lol… i dont know how :o

rogeruk

2009-11-26 17:32:51

Little offtopic,

I used a MySQL database for my script signatures.

SCAR > PHP
PHP > MYSQL
PHP > IMAGE


Like that :P

Awkwardsaw

2009-11-26 19:27:56

From: rogeruk
Little offtopic,

I used a MySQL database for my script signatures.

SCAR > PHP
PHP > MYSQL
PHP > IMAGE


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

2009-11-27 07:00:20

From: Awkwardsaw
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.