Help with the Catcher please...

Ask questions, request features, or just complement us about our software and services.
Post Reply
needleboy
Posts: 4
Joined: Fri May 09, 2003 4:06 am
Location: Israel
Contact:

Help with the Catcher please...

Post by needleboy »

I'm really stuck with this, and would like someone to help me, as this is quite important to me. Thanks.

First of, take a look at the logo on my site: http://needleboy.mine.nu
As you can see, I'm also using the whatplaying.php on the logo to create the song's title and curent listeners on the PNG image of the logo.
What I would like to know is how can I add to this info the server status, and bitrate?
I've checked the includes.php file, and it has the info there:

Code: Select all

$server[0]['bitrate']='32';
$server[0]['status']='Online';
How do I create the output to the image from the whatplaying.php file?
Right now it looks like this:

Code: Select all

<?php
include("includes.php");
header("Content-Type: image/png");
$im = imagecreatefrompng("logo.png");

if ($im)
{
ImageString($im,  2,  31,  10,  "::Listeners: $listeners/$max_listeners::",  50);
ImageString($im,  2,  31,  100,  "::Now Playing: $current_song::",  50);

ImagePNG($im);
}
?>
How can I use the ImageString command to display the $server output?

I tried:

Code: Select all

ImageString($im,  2,  31,  10,  "Status: $server[0]['status']",  50);
and:

Code: Select all

ImageString($im,  2,  31,  10,  "Status: $status",  50);
but they're not working.

Can anyone help me?
User avatar
Jay
Will work for food (Administrator)
Posts: 3029
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

that should work the only thing wrong is that you are placing the image right on top of another imagestring, the imagestring function works just like any other image editor's txt tool so you may want to place it somewhere else on the image. Check out http://us4.php.net/manual/en/function.imagestring.php for more information on the Image string function and how to use it.
- Jay
needleboy
Posts: 4
Joined: Fri May 09, 2003 4:06 am
Location: Israel
Contact:

Post by needleboy »

Nah, that's not the thing. I put it in another place. Problem is that when I put the string $server it returns 'Array' on the image.
I need to put something there instead of the $server or maybe add something to cather.php that will write another value into includes.php
Dunno.
User avatar
Jay
Will work for food (Administrator)
Posts: 3029
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

you should put

$server[0]['status']

not just $server as that is an array and you need to be more specific as to what data you want to get when working with arrays.
- Jay
needleboy
Posts: 4
Joined: Fri May 09, 2003 4:06 am
Location: Israel
Contact:

That's what I did now

Post by needleboy »

I put the following:

Code: Select all

ImageString($im,  2,  300,  10,  "::Status: $server[0]['status'] ::",  50);
It returned the following on the picture:

::Status: Array['status'] ::

That's what happened at the beggining as well...
Can you figure it out?
User avatar
Jay
Will work for food (Administrator)
Posts: 3029
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

try this

Code: Select all

ImageString($im,  2,  300,  10,  "::Status: ".$server[0]['status']." ::",  50);
- Jay
needleboy
Posts: 4
Joined: Fri May 09, 2003 4:06 am
Location: Israel
Contact:

Whoa dude :)

Post by needleboy »

Thanks man!

Just shows how much I know about PHP :wink:
Tomorrow I'll steal a PHP book from the bookstore I work in...

What do you think of my site?

Thanks again!
NeedleBoy.
phaseiii
Posts: 9
Joined: Tue Aug 10, 2004 12:13 am

Post by phaseiii »

Alternatively, you could also do:

Code: Select all

ImageString($im,  2,  300,  10,  "::Status: {$server[0]['status']} ::",  50); 
Notice the {Curly-Brackets} around the multi-dimensional array? :)
Post Reply