我创建了一种从 aws S3 获取数据(图像文件)的方法,如下所示:
public static function getImage ($imagePath)
{
if(Storage::exists($imagePath))
{
return Storage::disk('s3')->get($imagePath);
}else
{
return 'No Image';
}
}
我确信这些图像存在于 aws 上,所以没有问题。
然后我使用上面的方法作为我的刀片视图中的 src ,如下所示:
{!!Html::image(getImage($myPath),'logo',['width'=>60,'height'=>55])!!}
$myPath here already point to the specific file on aws for example : bucket/file.jgp. But when I run my webpage, this Html::Image gives a view like this :
![enter image description here](https://i.stack.imgur.com/51tLL.png)
这里发生了什么 ?为什么 Html::image 无法渲染我的图像文件? :(
适用于 Laravel 6.x
<img src="{{Storage::disk('s3')->url($imagePath)}}">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)