Getting Track Artwork from Spotify using PHP

Posted 14th December 2012

At time of writ­ing, Spo­tify doesn’t pro­vide a track’s art­work via its API.

So, I’ve writ­ten a sim­ple func­tion to get the image; but please note, not only is it quick and dirty, but it’s hor­ri­bly inef­fi­cient and should be used spar­ingly — at the very least, make sure you cache the results somewhere!

You can access a public-​facing web-​page about a par­tic­u­lar track using the fol­low­ing URL:

http://open.spotify.com/track/[TRACK-ID]

…where [TRACK-​ID] is the last part of the track’s URI — so for exam­ple, for the track rep­re­sented by the URI spotify:track:5fpizYGbi5IQoEraj6FP0R, the track ID would be 5fpizYGbi5IQoEraj6FP0R, and thus the URL to the page would be: