
|
|
|||
PHP Dynamic Signature: Now Playing (Winamp)By Joe S2005-08-16
PHP Dynamic Signature: Now Playing (Winamp) In this tutorial I will teach you how to make a dynamic image using PHP. The image will have text saying the last two songs you listened to (if you are currently listening) or the last song you listened to (if you aren't currently listening). In order to get this info, you will have to be using Winamp, and this plugin. Once you've installed the plugin you have to set up a template that will upload every time you change the song. For this tutorial the template you should use it the following: [np:IsPlaying]Now[/np:IsPlaying][np:NotPlaying]Last[/np:NotPlaying]Just save that as a .html file in your /Winamp/np_templates folder. Then go to the plugin preferences (In Winamp, Ctrl + P > Plug-ins > General Purpose > Now Playing plug-in vN.N > Configure > HTML Settings tab) select your template name from the dropdown box and check 'Use template.' Then, go to the FTP tab and fill in your FTP info. Set the filename to 'data.txt' (without quotes) Now, whenever your song changes, a file will be uploaded to your server (to the path specified) with the following format: 'Now' or 'Last' - Depending on whether or not you are listening now.Now we need the PHP code to parse this file, and write the data to an image. <?php Now for the explanation: The first few lines are a cut function that cuts a string to the specified length. We will use this for chopping off text that is longer than the length of the image.Then we actually create the image from a background file that you have. After that we parse the data.txt file that has all of the song info: 1. Check to see if you are listening now, or not. 2. Extract the Artists and Titles. Now we will have two variables set – one for current, and one for last. All we have to do now is write the strings to the image. $width will be the width of the text (anything more will get turnicated)$font will be the size of the font.Not much more to explain, the rest is self explanitory. Check this out to see what I've done with this. Tutorial Pages: » PHP Dynamic Signature: Now Playing (Winamp) © 2005 Joey Shamah |
||||
| About the NetVisits, Inc Network | Write For Us | Advertise Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |
Visit other NetVisits, Inc. sites: |