问题描述
我在laravel 7.6项目上使用 spatie/laravel-medialibrary:8.2 包.
I am using spatie/laravel-medialibrary:8.2 package on my laravel 7.6 project.
我要使用 Backblaze Cloud Storage将媒体数据存储在 gliterd/laravel-backblaze-b2 包.
I am going to store media data on Backblaze Cloud Storage using gliterd/laravel-backblaze-b2 package.
我如下制作了名为media
的文件驱动程序,并在media-library.php
中将其用作文件驱动程序.
I made file driver called media
as following and using it in media-library.php
as file driver.
当我上传文件时,它存储在我想要的确切目录中.但是当我要检索它时,出现以下错误.
When I uploaded file, it stored on exact directory what I wanted. But when I was going to retrieve it, I got following error.
This driver does not support retrieving URLs
媒体库软件包不支持B2存储吗?
Media-library package doesn't support for B2 storage?
如果是这样,那么我认为可以很容易地使自定义url获得功能.
If so, then I think It's possible to make custom url get function easily.
B2存储桶信息,文件目录和文件名存储在媒体库表中.
B2 Bucket info, file directory and filename are stored in media library table.
文件位置如下.
https://f000.backblazeb2.com/file/[bucket name]/[file id]/[file name ]
有人可以帮助我提供良好的解决方案吗?
Can anyone help me with good solution?
谢谢
推荐答案
您也可以将AWS S3驱动程序用于Backblaze.他们于2020年5月4日发布了S3兼容API.
You can use AWS S3 driver as same for Backblaze too.They released S3 Compatible API on May 4, 2020.
您可以在帐户中获取应用程序密钥,而不是主应用程序密钥.
You can get Application Key in your account instead of master application key.
您需要三件事情才能将您的集成与 Backblaze S3兼容的API:
There are three things you need to connect your integration with the Backblaze S3 Compatible API:
- S3端点
- 应用程序密钥
- 应用程序密钥ID
- S3 Endpoint
- Application Key
- Application Key ID
这将为您提供帮助.
https://help.backblaze.com/hc/zh-CN/articles/360047425453
这篇关于Spatie/Laravel-medialibrary无法从Backblaze存储中检索文件:此驱动程序不支持检索URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!