ricbra / php-discogs-api

PHP 5.4 Implementation of the Discogs API
MIT License
152 stars 95 forks source link

getImage sends 404 Not Found #22

Closed starise closed 9 years ago

starise commented 9 years ago

I receive a [status code] 404 [reason phrase] Not Found, using getImage.

[url] http://api.discogs.com/images/R-5840514-1404162639-4473.jpeg.jpg [status code] 404 

When i send a request using getRelease i can see images passed using a different url like: http://api-img.discogs.com/{....}

Seems like a discogs change in API. Can be this OAuth related?

Thanks.

ricbra commented 9 years ago

Hi @starise

Thanks for reporting this issue. It seems Discogs updated their API and moved all images to a dedicated images cluster: https://www.discogs.com/developers/#page:changelog

I hope I have some time to fix this in the next couple of days. If you have fixed it already don't hesitate to submit a PR.

ricbra commented 9 years ago

The old endpoint still works. Make sure you sign the request with OAuth. Try this image:

$response = $discogs->getImage([
     'filename' => 'A-20-1138033731.jpeg'
]);

echo $response['image'];

The new images can be fetched like this (without OAuth):

$response = $discogs->getArtist([
    'id' => 20
]);
foreach ($response['images'] as $image) {
    var_dump((string) $discogs->getHttpClient()->get($image['uri'])->getBody());
}