<?php /** * * @author Antoine Mady * */ header("Content-Type: text/plain"); require_once "config/config.inc"; $db = $_SESSION['db']; $artists = explode("%@", $_POST['artists']); $artist = $artists[0]; // The first one is the good one! $album = $_POST['album']; print LastFMArtwork::getArtwork(utf8_encode($artist), utf8_encode($album), true, 'mega');
public static function storeArtworkFromAPI($album, $size = "mega") { $db = $_SESSION['db']; $album = new Album($album); $artist = $album->getMainArtist(); $artist_name = strtr($artist->getName(), array('.' => '', ',' => '')); $album_name = strtr($album->getName(), array('.' => '', ',' => '')); if (file_put_contents("img/albums/" . $album->getId() . ".jpg", file_get_contents(LastFMArtwork::getArtwork(utf8_encode($artist_name), utf8_encode($album_name), true, $size)))) { return true; } return false; }