This page was copied from the old Audioscrobbler Wiki page, and is probably out of date and still incomplete, but is still helpful.


If you're looking for a complex and extensible way of making a playlist image, the current page is for you. Otherwise, you may want to check out this wiki page, which has a pretty simple 1-script setup.


  1. Download the latest version.
  2. Unpack the files to a folder on your computer.
  3. Create a subdirectory on your web hosting account to host the image.
  4. Edit index.php and put your username in the $user variable. You can edit most (but not all) the stuff in this file. See the comments in the file for helpful info.
  5. FTP the files into the directory you created for them.
  6. Chmod the directory so that it gives FULL WRITE (777) access. If you get an error in your ftp client while trying to do this, then it seems that you host may not have given you permissions to do so, therefore you will not be able to host this there.
  7. You should now be able to access your image by entering an address like this


index.php - this file can be renamed to anything you like. You can even make a copy of it in the same directory and have 2 versions of the code running with different options/settings. They will both require the same font file and RPI.php file, so there is no need to create a directory for different options you set up.

sig.php - this file could be used instead of index.php. It is identical, except I've set the options so that it creates a smaller image which could be used in a forum signature.

RPI.php - this file does all the work. Do Not Edit or rename it!

Vera.ttf - default font - it has been tested, and sometimes you may have to rename the font(and in your settings file) to make it work correctly. (try using the full directory path e.g. /home/yourusername/www/whatever/Vera.ttf) or set it to getcwd().'/Vera.ttf'; I will make this change in the code soon.

White List

Set $whitelist to false to disallow the whitelist feature.

$whitelist = false;

Set $whitelist to the name of a filename which contains a word boundary delimited list of audioscrobbler usernames who are allowed to use this script by setting the username query string argument. (see Argument Support) This only works if the username argument can be set via the query string.

$whitelist = 'mywhitelist.txt';

Argument Support

Set $use_args to false in your main file to disable query string arguments.

$use_args = false;

Set $use_args to true to allow ALL supported query string arguments to override those written below. Set $use_args to false in your main file to disable query string arguments.

$use_args = true;

The currently supported arguments that can be changed via the query string are currently as follows (the option is on the left, and it maps onto the variable with the name on the right in your main file. So u, user, and username all override the $user variable for example. List of Arguments, Added for Laurie (

'ft' => 'feed_type',
'u'        => "user",
'user'     => "user",
'username' => "user",
'fs'       => "options['fontsize']",
'fontsize' => "options['fontsize']",
's'    => "options['show']",
'show' => "options['show']",
'cs'      => "options['spacing']",
'spacing' => "options['spacing']",
'cp'      => "options['padding']",
'padding' => "options['padding']",
'b'      => "options['border']",
'border' => "options['border']",
'bc'          => "options['colors']['border']",
'bordercolor' => "options['colors']['border']",
'bg'  => "options['colors']['bg']",
'bg1' => "options['colors']['bg1']",
'bg2' => "options['colors']['bg2']",
'artist' => "options['colors']['artist']",
'ac'     => "options['colors']['artist']",

'text' => "options['colors']['text']",
'tc'   => "options['colors']['text']",
'date' => "options['colors']['date']",
'dc'   => "options['colors']['date']",
'num' => "options['colors']['num']",
'nc'   => "options['colors']['num']",
'title' => "options['colors']['title']",
'tic'   => "options['colors']['title']",

'timezone' => 'timezone',
'tz'       => 'timezone',
'timezone_alt' => 'timezone_alt',
'tza'          => 'timezone_alt',
'width' => "options['width']",
'w'     => "options['width']",
'header' => "options['headertext']",
'h'      => "options['headertext']",
'headeralign' => "options['headeralign']",
'ha'          => "options['headeralign']",
'erroralign' => "options['erroralign']",
'ea'         => "options['erroralign']",
'url'    => "options['urlalign']"

There is a third way to set $use_args, and that is to limit the particular options that can be passed via the query string. To do this, set $use_args to an array hash of mappings of options. For example:

$use_args = array(
        'timezone' => 'timezone',
        'tz'       => 'timezone',
        'timezone_alt' => 'timezone_alt',
        'tza'          => 'timezone_alt',
        'header' => "options['headertext']",
        'h'      => "options['headertext']",

This code above will allow the timezone, timezone_alt, and header to be set via the query string and NOTHING ELSE. There is not much use for this particular example, but you could allow every option except for username if you liked, so that you can have a number of varying styles of image all for yourself. If you are thinking of hosting this script for lots of people to use, you might want to allow every option to be set EXCEPT the fontsize, padding, spacing, border, show, and width options. This will keep your hosted image a predefined style, but still allow users to change the colours of their image.

example urls: Recently Listened to Songs

on BBCode supported sites you will have to add /rpi.jpg to the end so that it recogonises it as an image.

example urls: Recently Listened to Songs/rpi.jpg

Setting it up with mod_rewrite

To host this script for the users of a website community your run, you'll first need a working Installation, and a Whitelist containing the audioscrobbler usernames of your community. You'll also need to setup Argument Support so people can pass their username to the script. It might also be good to have the username as the only argument that can be overridden so that everybody on your site has the same style image.

Now that you hopefully have a working version of this code, you can now check whether your community supports putting images on it that have a question mark (?) in. Many sites that support BBCode don't support this, and end up just inserting the address as text into the site. To save yourself the hassle of doing the next steps if you don't need to, test your site and input an image with an example address like making sure that the username you insert is whitelisted.

If your image generator is definitely working, and your site doesn't accept that as an image, then follow the next couple of steps.

For this next step your web hosting has to be able to support .htaccess configuration files.

Create a file on your computer called ".htaccess" with the following text:

RewriteEngine On Options +FollowSymlinks
RewriteRule [dir]/([^/]+)/([^/]+)/?([^?]*)$ [dir]/$3?$1=$2 [QSA,L]
RewriteRule [dir]/ [dir/to/your/installation]/ [L]
  • Replace dir? with the name of a nonexistent directory in the root of your web hosting that you want your image to be hosted from. If you want your image to be hosted from then replace dir? with rpi.
  • Replace dir/to/your/installation? with the address of your already installed copy of this script. You can't have them as the same directory, dir? must NOT exist.

For Example Your installation is under You want users of your website to access their image via the url

This would be your .htaccess file:

RewriteEngine On Options +FollowSymlinks
RewriteRule rpi/([^/]+)/([^/]+)/?([^?]*)$ rpi/$3?$1=$2 [QSA,L]
RewriteRule rpi/ audioscrobbler/recentlyplayed/ [L]

NOTE: I don't think you can have a directory that ends with the same as your value for dir? on your website, as that directory will become inaccessable to your visitors.

Now upload your ".htaccess" file to the root folder for your website.

You should now be able to access your script like this:

for example:

would produce: and