有什么方法可以使用 Laravel 将图像上传到 Imgur。
我目前正在使用
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.imgur.com/3/image', [
'headers' => [
'authorization' => 'Client-ID ' . 'app_id',
'content-type' => 'application/x-www-form-urlencoded',
],
'form_params' => [
'image' => base64_encode(file_get_contents($request->file('thumbnail')))
],
]);
return response()->json(json_decode(($response->getBody()->getContents())));
我的刀片文件是
<tr>
<td>Thumbnail</td>
<td>
<input type="file" name="file" id="file">
</td>
</tr>
我继续得到Call to a member function path() on null
我想要做的是上传文件,将其上传到 Imgur 并获取 URL 以将其插入到我的数据库中。
开满天机
慕桂英3389331