Blueimp S3缩略图不显示

时间:2018-11-13 03:37:47

标签: json laravel amazon-s3 blueimp laravel-5.7

我在Laravel 5.7项目中使用的是带有S3的Blueimp,上传效果很好,但是上传后没有显示缩略图。我正在使用一个临时URL来查看文件,但是只有缩略图不起作用。有人遇到过类似的问题吗?

上传Blueimp的返回JSON

$photographSave = $album->photograph()->create($data);
  

photographSave =模型照片,$ photographSave-> photograph =网址文件

return [
    'files' => [
        [
            'deleteType' => '',
            'deleteUrl' => '',
            'name' => $name,
            'size' => \Storage::disk('local')->size($path . $name),
            'type' => 'image/' . $request->file('files')[0]->getClientOriginalExtension(),
            'thumbnailUrl' => UploadFile::getThumbS3($photographSave->photograph),
            'url' => UploadFile::getFile($photographSave->photograph),
        ],
    ]
];

生成URL函数

protected static function getThumbS3($file)
{
    try {
        return
            Storage::disk('s3')->temporaryUrl(
                $file, Carbon::now()->addMinutes(5)
            );
    } catch (\Exception $e) {
        return $e->getMessage();
    }
}

0 个答案:

没有答案