Recent Album Artwork Plugin

My blog is now running a WordPress plugin that shows the album covers from of songs I’ve recently listened to. There’s a lot of plugins out there, but none that I found that did the job of getting the artwork, and certainly not for the most recent albums.

Download the recent album artwork plugin Integration

You’ll need a account and the iScrobbler running to store the recent tracks at To check, you can view the recent tracks feed changing remysharp to your username.


Download the recent album artwork plugin and save it in your plugins directory (usually located in wp-content).

Then activate the plugin from the Plugins tab in your WordPress admin tools.


Through the Options -> Recent Albums tab fill out the required fields.

Album Art Cache Settings

You must ensure the directory that you point the plugin to is writable. You can use either full or relative paths for the album artwork.

For example, my album artwork is located at, so my URL is set to:


Within my WordPress set up, this is physically located in /home/remy/, but I’ve set the path to be relative in the settings, so it reads:


Since the root of my WordPress installation is /home/remy/ this works just fine.

Adding to your Blog

Once the setup is complete, use the get_lastFM_album_artwork() function to add the album artwork to you blog. My blog adds the code as follows (with the setup wrapping the elements with li)

<?php if (function_exists('get_lastFM_album_artwork')) { ?>
<div class="lastfm">
<h3>Recent Albums</h3>
<?php } ?>

Behind the Scenes

Behind the scenes the code will only show album artwork if have the album associated (there’s a number of tracks that don’t have that information linked). If there’s not enough recent tracks from the feed, the plugin will fill the rest of the albums based on the recently played albums (using timestamps from the artwork files).

The plugin will also avoid showing the same album cover twice.


If you have any problems or suggestions or questions about the plugin, please let me know and I’ll do my best to help.

67 Responses to “ Recent Album Artwork Plugin”

  1. Hi!
    Thanks for your great plugin, it really rocks! Just one thing: I’ve figured out that $url now has to be ..blabla..artist/_/track and NOT artist/album/track.

    After changing it in the code everything works like a charm! Congrats.

  2. Hi!

    My goodness, I don’t understand. I give up… :-P

    I installed the plugin and followed the instructions with tchmod on to 777 but “Album path must exist and be read/write permissions (/home/gwen-gwen/” Arrgh !!!

    What’s going wrong? Full path?!?

    By advance, thanks :-)

  3. [...] Recent Albums and Artwork by Remy Sharp [...]

  4. [...] Recent Albums and Artwork by Remy Sharp [...]

  5. Hey Remy,

    I’ve just moved to a new server, everything seems to be working fine apart from the album artwork plugin is giving me an error:

    Warning: touch() [function.touch]: Utime failed: Permission denied in /home/daleanth/public_html/wp-content/plugins/lastfm_albums_artwork.php on line 187

    I’ve had a look at the permissions and they all seem to be right. I’ve also tried de-activating and re-activating the plugin with no luck. Any ideas what else could be causing this?


  6. @Dale – I’m pretty sure it’s still a permissions issue.

    When you run ls -ltrFa on the directory with the images – what do you get?

  7. I just tried creating a new directory which seems to have fixed the problem :)

  8. [...] Recent Album Artwork 这个WordPress插件显示最近在Last.fm听的歌曲的专辑封面。 [...]

  9. Hi, I’m using your amazing plugin but I noticed there’s something wrong. Covers that appear on my site are not those appearing on the audioscrobbler ( software)…

    Am I wrong or what?

  10. [...] Recent Album Artwork [...]

  11. [...] Recent Album Artwork [...]

  12. Parse error: parse error, unexpected T_OBJECT_OPERATOR in D:\hosting\wwwroot\evanwu_org\htdocs\story\wp-content\plugins\lastfm_albums_artwork.php on line 158

    Can u help me to fix?

  13. The API doesn’t put the actual album but the one with most listeners where the song appears.

  14. Hey, your plugin has been great. But I was looking at my site recently, and noticed that the Album name had dropped the first letter, the track names were gone, and the $url command was also missing a letter. I assume that changed something in their feed. Was wondering if you knew what was going on. Here is how I have my code implemented, and I use UL tags with the function on the template:

    <li class="album">
    <p><a href="$url">$artwork</a></p>
    <p class="rcontent">$album - $track</p></li>
  15. Hi,
    I have installed you plugin on my development site,, but I cannot seem to get your plugin working properly.
    All of the track information displays perfectly, but I don’t get any album artwork.

    My HTML format is:

      <p class="artist"><a href="$url" target="_blank">$artist</a></p>
      <p class="album">$album</p>
      <p class="track">$track</p>

    I filled out the URl field with: /wp-content/lfmCache/
    And the Full Path with: wp-content/lfmCache

    I have set the permissions on this folder to 0777.

    Even after doing all of this I cannot seem to get the album art to appear.

    Is their anything I can do to fix this?

    Thanks for all your work,

  16. Still loving the plugin, by far the best for display recent tracks from

    One small problem though…

    I just moved host to media temple, since doing so I can’t get the album artwork to show (there are no errors).

    I’m using a custom directory for the core wordpress files and a custom directory for the media uploads too (other than /wp-content/uploads/ i’m using /wp-content/media/).

    All my settings appear to be correct but nothing is showing.

    Any ideas?


  17. Update to my previous comment for those who are having the same issue…

    It turns out that the reason nothing was displaying on my website was because ‘allow_url_fopen’ was disabled in my PHP configuration.

    If you’re having the same issue you can fix it by adding the following line to your php.ini file (in some cases your web-host will not allow you to do so):

    allow_url_fopen = On

Leave a Reply
Not required

CODE: Please escape code and wrap in <pre><code>, doing so will automatically syntax highlight