whatimplayin.php

Ask questions, request features, or just complement us about our software and services.
Post Reply
mrlayance
Posts: 12
Joined: Thu Mar 13, 2003 4:03 pm

whatimplayin.php

Post by mrlayance »

I was just wondering if anyone knows how to make the image resize with the length of text outputed?

I just have the basic setup http://www.hipbase.com/radio/whatimplayin.php

I knoticed hows jays sig image always resizes.

Thanks
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

yea I have somewhat modified it from the original script and cannot release the updated script due to the fact that I now use True Type Fonts, and some installations of PHP will not support it. The TTF functions are what I used to determine how wide the image should be.

If you have the true type library installed check out the following two functions

imagettfbbox -- Give the bounding box of a text using TrueType fonts
imagettftext -- Write text to the image using TrueType fonts
- Jay
mrlayance
Posts: 12
Joined: Thu Mar 13, 2003 4:03 pm

Post by mrlayance »

How do I change the font color?

Code: Select all

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

ImageString($im,  1,  37,  4,  "Hipbase.com Radio - Live Tragically Hip".$desc, 5);
ImageString($im,  2,  67,  12,  "Currently Playing: ".$current_song,  1);
ImageString($im,  2,  67,  23,  "There are $listeners / $max_listeners listeners",   2);
ImagePNG($im);
}
?>
http://www.hipbase.com/radio/whatimplayin.php
mrlayance
Posts: 12
Joined: Thu Mar 13, 2003 4:03 pm

Post by mrlayance »

How do I change the font color?

Code: Select all

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

ImageString($im,  1,  37,  4,  "Hipbase.com Radio - Live Tragically Hip".$desc, 5);
ImageString($im,  2,  67,  12,  "Currently Playing: ".$current_song,  1);
ImageString($im,  2,  67,  23,  "There are $listeners / $max_listeners listeners",   2);
ImagePNG($im);
}
?>
http://www.hipbase.com/radio/whatimplayin.php
Noumaios
Posts: 1
Joined: Tue May 13, 2003 4:03 pm
Location: Spain
Contact:

how to resize the image?? o_O

Post by Noumaios »

Hi Jay, i'm not into php :?
so would you mind to post the updated script please
And is it possible to show Currently Offline if you are offline?
Thanks in advance 8)
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

colors are referenced from the original image, the last number parameter given in the image string function points to the color in the png color palette. If you want to add colors to the pallete, be sure to do this before calling ImageString, and use the number returned by the function, imagecolorallocate. For a complete list of functions related to php image creation: read http://www.php.net/manual/en/ref.image.php
- Jay
Post Reply