image problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bst82551
Forum Newbie
Posts: 15
Joined: Wed Dec 29, 2004 12:25 pm
Location: Huntsville, Texas

image problems

Post by bst82551 »

Two questions:

1. How do I get the image to automatically expand to the size of the text string from the song.txt file? Is this possible?

2. Why is there a strange yen type character being displayed after each song? Here's an example:
Image

Code: Select all

<?php

$song = fopen("http://bst82551.ath.cx:8181/song.txt", "r");
$name = fread($song, 1024);
$im = imagecreatetruecolor(300, 15);
$color = imagecolorallocate($im, 223, 223, 223);
imagestring($im, 2, 1, 1, "Now Playing: ".$name."", $color);
imagejpeg($im);
imagedestroy($im);

?>
Brian
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://php.net/imageftbbox

would probably be the best bet to know how big of an image to make.

As for the symbols, it's looks like an artifact of the output, or ancillary binary data..
Post Reply