【发布时间】:2019-10-31 14:21:34
【问题描述】:
我需要从 S3 中检索图像并使用 Laravel 将其发布到 Twitter。图片是使用 Vapor (Vue js) 和存储在数据库中的路径 URL 上传的。示例 URL (https://rippleflare-s3-dev.s3.amazonaws.com/7f87e5a4-f157-483e-8dcb-59a735194747)。该图像可通过浏览器访问,但当我尝试获取这样的图像时
Storage::disk('s3')->get($post->media_url)
中间网址是https://rippleflare-s3-dev.s3.amazonaws.com/7f87e5a4-f157-483e-8dcb-59a735194747 我得到错误
Illuminate \ Contracts \ Filesystem \ FileNotFoundException https://rippleflare-s3-dev.s3.amazonaws.com/7f87e5a4-f157-483e-8dcb-59a735194747
我的问题,如何使用文件 URL(路径)从 Laravel 中的 S3 检索文件
【问题讨论】:
-
您不向 S3 询问 URL,而是向已配置存储桶中的对象询问。
7f87e5a4-f157-483e-8dcb-59a735194747在这种情况下。 -
感谢@deefour 现在工作正常