FYI: I used portions of your script to modify mine for dynamic width
Now, the image is only as wide as necessary.
code:
// Build the artist, album, song strings
$artistString = "Artist: ".$song['artist'];
$albumString = " Album: ".$song['album'];
$songString = " Song: ".$song['title'];
// Initialize the length
$maxStringSize = 0;
// Bubble the longest string length to maxStringSize
if (strlen($artistString) > $maxStringSize)
$maxStringSize = strlen($artistString);
if (strlen($albumString) > $maxStringSize)
$maxStringSize = strlen($albumString);
if (strlen($songString) > $maxStringSize)
$maxStringSize = strlen($songString);
// Build the image length at 5 pixels per character in the longest string
$imageWidth = 5 * $maxStringSize;
// Create the image
$im = imagecreate ($imageWidth, 27);
Thanks for the inspiration