hexcss / wp-cloud-upload
一款用于将媒体文件上传到 Google Cloud Storage 的 WordPress 插件。
v1.0.1
2024-09-03 18:53 UTC
Requires
- php: >=7.4
- google/cloud-storage: ^1.25
This package is auto-updated.
Last update: 2024-09-03 18:54:58 UTC
README
版本: 1.0.0 作者: Javier Cáder Suay
概览
云上传插件 允许您无缝地将 WordPress 媒体文件上传到 Google Cloud Storage,无需本地存储。此插件自动将文件上传到指定的 Google Cloud Storage 桶中,按年月组织文件,并将本地文件 URL 替换为 Google Cloud 的公共 URL。此外,当媒体文件从 WordPress 媒体库中删除时,它们也会从 Google Cloud Storage 中删除。
功能
- 将媒体文件上传到 Google Cloud Storage。
- 在桶内按
年/月
目录结构组织上传的文件。 - 将本地文件 URL 替换为 Google Cloud Storage 的公共 URL。
- 从 WordPress 中删除媒体文件时,自动从 Google Cloud Storage 中删除。
要求
- WordPress 5.0 或更高版本
- PHP 7.4 或更高版本
- Google Cloud Platform (GCP) 账户
- 启用了统一桶级别访问的 Google Cloud Storage 桶
安装
-
克隆存储库
git clone https://github.com/Hexcss/wordpress-cloud-upload-plugin.git wp-content/plugins/cloud-upload-plugin
-
导航到插件目录
cd wp-content/plugins/cloud-upload-plugin
-
安装 Composer 依赖项
确保您已经在系统上安装了 Composer。然后,运行
composer install
-
激活插件
配置
-
Google Cloud 设置
- 创建一个启用了统一桶级别访问的 Google Cloud Storage 桶。
- 创建一个具有存储管理员权限的服务帐户。
- 以 JSON 格式下载服务帐户密钥。
-
插件配置
- 在 WordPress 管理仪表板中,转到 设置 > 云上传。
- 将您的 Google Cloud 服务帐户 JSON 的内容粘贴到 服务帐户 JSON 字段中。
- 在 桶名称 字段中输入您的 Google Cloud Storage 桶名称。
- 保存设置。
用法
上传媒体文件
- When you upload a file through the WordPress media library, it will automatically be uploaded to Google Cloud Storage.
- The file will be stored in a year/month directory structure within your bucket.
- The URL of the file in WordPress will be replaced with the public URL from Google Cloud Storage.
删除媒体文件
- When you delete a media file from the WordPress media library, the plugin will automatically delete the corresponding file from Google Cloud Storage.
故障排除
- File Not Found: Ensure the Google Cloud Storage bucket is publicly accessible.
- Permissions Issues: Double-check the service account permissions and that the service account JSON is correctly configured in the plugin setting
贡献
欢迎贡献!如果您发现了一个错误或有一个改进的想法,请打开一个问题或提交一个拉取请求。
未来功能和路线图
在以下文档中了解有关即将推出的功能和开发计划