Closed ghost closed 8 years ago
Hi,
Thanks for reporting this issue. I'll investigate as soon as I find the time. Didn't knew the image URIs where changed.
Op za 7 mei 2016 17:49 schreef colterfrazier notifications@github.com:
Hello, I have been struggling with this for a while and am unable to come to a resolution myself, so I am hoping you are able to help. Discogs switched to fully qualified URLs a while ago, and I cannot seem to be able to get the getImage operation to succeed. I have changed the base URL in service.php to blank, and changed the getImage operations to: 'getImage' => [ 'httpMethod' => 'GET', 'uri' => '{filename}', 'responseModel' => 'GetImage', 'parameters' => [ 'filename' => [ 'type' => 'string', 'location' => 'uri', 'required' => true ] ] ],
I am using the following code to call the getImage operation: $img = $client->getImage([ 'filename' => $imgurl ]);
where $imgurl is something like ' https://api-img.discogs.com/h5jo0FYxTiv0kE6vnKBbpJ5_oyM=/fit-in/600x594/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-3031242-1312599382.jpeg.jpg '.
But I keep getting the error
Catchable fatal error: Argument 4 passed to GuzzleHttp\Command\Guzzle\Subscriber\ProcessResponse::visitOuterObject() must implement interface GuzzleHttp\Message\ResponseInterface, null given, called in C:\wamp\www\Viscogs\vendor\guzzlehttp\guzzle-services\src\Subscriber\ProcessResponse.php on line 106 and defined in C:\wamp\www\Viscogs\vendor\guzzlehttp\guzzle-services\src\Subscriber\ProcessResponse.php on line 148
All other requests such as getRelease and getOAuthIdentity are working just fine. What is it about getImage that is causing it to fail? I have been struggling with this and hope it may be easy for you to see what is wrong. Please let me know if you need any further information to help troubleshoot the problem.
Thank you!
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/ricbra/php-discogs-api/issues/38
They've moved the images under their own dedicated host and indeed supply the fully qualified url in the response. So you can just use the internal client to get an image:
$release = $client->getRelease([
'id' => 1
]);
foreach ($release['images'] as $image) {
$response = $client->getHttpClient()->get($image['uri']);
// response code
echo $response->getStatusCode();
// image blob itself
echo $client->getHttpClient()->get($image['uri'])->getBody()->getContents();
}
I'll remove the getImage
operation and update the README.md accordingly.
Hello, I have been struggling with this for a while and am unable to come to a resolution myself, so I am hoping you are able to help. Discogs switched to fully qualified URLs a while ago, and I cannot seem to be able to get the getImage operation to succeed. I have changed the base URL in service.php to blank, and changed the getImage operations to:
'getImage' => [ 'httpMethod' => 'GET', 'uri' => '{filename}', 'responseModel' => 'GetImage', 'parameters' => [ 'filename' => [ 'type' => 'string', 'location' => 'uri', 'required' => true ] ] ],
I am using the following code to call the getImage operation:$img = $client->getImage([ 'filename' => $imgurl ]);
where $imgurl is something like 'https://api-img.discogs.com/h5jo0FYxTiv0kE6vnKBbpJ5_oyM=/fit-in/600x594/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-3031242-1312599382.jpeg.jpg'.But I keep getting the error
All other requests such as getRelease and getOAuthIdentity are working just fine. What is it about getImage that is causing it to fail? I have been struggling with this and hope it may be easy for you to see what is wrong. Please let me know if you need any further information to help troubleshoot the problem.
Thank you!