mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 20:26:42 +00:00
Handle image URLs with query parameters returned from an external barcode lookup plugin
This commit is contained in:
@@ -626,7 +626,7 @@ class StockService extends BaseService
|
||||
{
|
||||
$webClient = new Client();
|
||||
$response = $webClient->request('GET', $pluginOutput['__image_url'], ['headers' => ['User-Agent' => 'Grocy/' . $this->getApplicationService()->GetInstalledVersion()->Version . ' (https://grocy.info)']]);
|
||||
$fileName = $pluginOutput['__barcode'] . '.' . pathinfo($pluginOutput['__image_url'], PATHINFO_EXTENSION);
|
||||
$fileName = $pluginOutput['__barcode'] . '.' . pathinfo(parse_url($pluginOutput['__image_url'], PHP_URL_PATH), PATHINFO_EXTENSION);
|
||||
file_put_contents($this->getFilesService()->GetFilePath('productpictures', $fileName), $response->getBody());
|
||||
$productData['picture_file_name'] = $fileName;
|
||||
}
|
||||
|
Reference in New Issue
Block a user