220) // For images higher than 220px { // This, simply put, just evenly spaces the text... $space=(imagesy($im)-$height*10)/13; $spacer=$space+$height; $y=$spacer; } else { // For smaller heights than 220px //...for smaller images it uses a static spacer the same height as the font $space=$height; $spacer=$space; $y=2; } //Customize the song text alignment and to your heart's content. $x=10; // Left margin of 10 //The last color will take effect - CHANGE TO MATCH YOUR IMAGE $text_color = imagecolorallocate ($im, 255, 255, 255);//white text $text_color = imagecolorallocate ($im, 122, 122, 122);//gray text $text_color = imagecolorallocate ($im, 56, 120, 219);//light blue text $text_color = imagecolorallocate ($im, 0, 0, 0); //black text $text_color = imagecolorallocate ($im, 210, 210, 210);//light gray text foreach ($rss->items as $item ) { $string = $item[title]; //Todo: Should verify that the string fits in the image here... //Uncomment the next two lines if you want text aligned right //$width = ImageFontWidth($font)* strlen($string) ; // Number of characters times font width //$x = imagesx($im) - ($width + 10); // Right margin of 10 imagestring ($im, $font, $x, $y, $string, $text_color); $y+=$spacer; } //CHANGE IF GIF imagejpeg ($im); //imagegif ($im); /* Credits: Keep a log of contributors here please: Date Alias (last fm or other) Email 03-07-2006 .. .. 06-17-2006 diginc aka injate abhillz at gmail dot com */ /* Sources: 03-07-2006 http://www.developertutorials.com/tutorials/php/adding-custom-text-to-image-050620/page1.html http://us2.php.net/manual/en/function.imagestring.php http://magpierss.sourceforge.net/ */ ?>