maczaaron Posted November 21, 2009 Share Posted November 21, 2009 I am trying to make an image with php that overlays my last played last.fm track (accessible via the rss feed://ws.audioscrobbler.com/1.0/user/theusernamehere/recenttracks.rss) onto a static image, background. I am very new to php, and have a starting point: <?php $myimage = imagecreatefrompng ( "mytemplate.png" ); $text_colour = imagecolorallocate( $my_img, 255, 255, 0 ); imagestring( $my_img, 4, 30, 25, "thesitewizard.com", $text_colour ); imagesetthickness ( $my_img, 5 ); header( "Content-type: image/png" ); imagepng( $my_img ); imagecolordeallocate( $text_color ); imagedestroy( $my_img ); ?> Now, instead of the text there right now, how can I make it grab the last played track from that rss feed and display it on the image (in the imagestring)? Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/182366-grab-last-listened-lastfm-track-from-rss-feed/ Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 You will need to open the RSS feed and read what the last value is. I recommend checking out Handling XML data over in the tutorials section. Link to comment https://forums.phpfreaks.com/topic/182366-grab-last-listened-lastfm-track-from-rss-feed/#findComment-962562 Share on other sites More sharing options...
maczaaron Posted November 23, 2009 Author Share Posted November 23, 2009 By the way, will this use a lot of bandwidth on my server? Picturing that the php gets requested 100+ times a day. Link to comment https://forums.phpfreaks.com/topic/182366-grab-last-listened-lastfm-track-from-rss-feed/#findComment-964220 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Depends on your definition of 'alot of bandwidth'. I doubt the size of the image should be much more than a few kilobytes, which gives a total transfer of a few hundred kilobytes. Link to comment https://forums.phpfreaks.com/topic/182366-grab-last-listened-lastfm-track-from-rss-feed/#findComment-964226 Share on other sites More sharing options...
maczaaron Posted November 23, 2009 Author Share Posted November 23, 2009 Well, because I have 15 GB bandwidth available a month (already using about 12 a month, so that leaves <3 GB a month for this). That means 100 MB a day, so I guess no problem. Link to comment https://forums.phpfreaks.com/topic/182366-grab-last-listened-lastfm-track-from-rss-feed/#findComment-964281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.