1 Star 0 Fork 4

cctvteam / wordpress-qcloud-cos

forked from 沈唁 / Sync QCloud COS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

Sync QCloud COS

Sync QCloud COS

使用腾讯云对象存储服务 COS 作为附件存储空间的 WordPress 插件

Latest Version License website contributors plugin stars plugin installs

插件特色

  • 可配置是否上传缩略图和是否保留本地备份
  • 本地删除可同步删除腾讯云上面的文件
  • 支持腾讯云COS存储桶绑定自定义域名
  • 支持替换数据库中旧的资源链接地址
  • 支持北京、上海、广州、香港、法兰克福等完整地域使用
  • 支持同步历史附件到 COS
  • 支持验证桶名是否填写正确
  • 支持腾讯云数据万象 CI 图片处理
  • 支持上传文件自动重命名

安装

后台安装(推荐使用)

WordPress 后台安装插件页面搜索Sync QCloud COS,点击安装

下载源码

从 Github 下载源码,通过 WordPress 后台上传安装,或者直接将源码上传到 WordPress 插件目录wp-content/plugins,然后在后台启用

Github 下载节点:https://github.com/sy-records/wordpress-qcloud-cos/releases/latest

修改配置

  • 方法一:在 WordPress 插件管理页面有设置按钮,进行设置
  • 方法二:在 WordPress 后台管理左侧导航栏设置腾讯云COS设置,点击进入设置页面

Contributors

This project exists thanks to all the people who contribute. [Contributors].

常见问题

  1. 怎么替换文章中之前的旧资源地址链接

这个插件已经加上了替换数据库中之前的旧资源地址链接功能,只需要填好对应的链接即可

  1. 使用子账户报错Cos Error Code: AccessDenied, Status Code: 403

可以使用子账户,但是 APPID 需要填写为存储桶创建者的ID,而不是子账户的ID。例如下文配置指南中的1250000000就是APPID

  1. 上传图片提示图像后期处理失败,请将其缩小到2500像素并重新上传

1)配置的存储桶名称填写错误,正确的配置参照 配置指南 中的存储桶名称

v1.6.1 版本增强了校验,填写错误会给予提示;同时兼容了桶名称附带APPID的情况

2)图片确实像素大于2500px,可以在functions.php中加入以下代码禁止大图片裁剪功能

add_filter('big_image_size_threshold', '__return_false');
  1. 从媒体库中删除了图片,但是COS中还是存在

原因是在配置页面选择了不在本地保留备份,因为WordPress机制问题,无法获取对应的文件信息

  1. 在插件中应该如何使用腾讯云数据万象CI

参考:腾讯云对象存储COS + 数据万象CI = 完善的图片解决方案腾讯云文档 - 使用图片样式

  1. 保存配置时报错:您的站点遇到了致命错误,请查看您的站点的管理电子邮箱来获得指引

这个问题应该只出现在Windows的机器上,打开WP_DEBUG的话会报错:Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: self signed certificate,解决方法如下:

1)从 https://curl.haxx.se/ca/cacert.pem 下载最新的cacert.pem
2)将以下行添加到php.ini中,注意修改对应的路径

curl.cainfo=/path/to/cacert.pem
  1. 保存配置时提示:ErrorCode:xxx, ErrorMessage:xxxx。如:ErrorCode:403, ErrorMessage:Request has expired

这种问题请直接前往腾讯云 对象存储文档 搜索对应的ErrorMessage信息即可,或者访问 对象存储错误码列表

配置指南

查看详细教程https://qq52o.me/2722.html

  • 存储桶设置

访问 腾讯云控制台 创建存储桶,把创建存储桶时要求你填写的存储桶名称,把存储桶名称填到这里就可以了,没有后面的-appid
examplebucket-1250000000,其中examplebucket为存储桶名称,1250000000为 APPID。

  • 存储桶地域

选择你创建存储桶时所选的地域即可。
如果地域选择全球加速,则在COS控制台中开启全球加速服务,具体方法和资费问题请查看 全球加速官方文档

  • APP ID、SecretID、SecretKey

APP ID 填写上文存储桶设置中所说的125000000即可;也可以访问 腾讯云控制台 获取 APP ID、SecretID、SecretKey

插件截图

设置页面

update-wordpress-posts-photos.png

更新记录

点击查看

2020-12-13

  • 修复版本号
  • 修复勾选不上传缩略图后不会删除云端缩略图
  • 升级 COS SDK 版本
  • 支持 WordPress 5.6 版本

2020-08-11

  • 修复多站点上传原图失败,缩略图正常问题
  • 优化上传路径获取

2020-07-24

  • 优化同步上传路径获取

2020-06-16

  • 修改常见问题和相关链接

2020-05-22

  • 增加南京地域

2020-05-15

  • 增加替换题图数据库链接

2020-05-04

  • 支持上传文件自动重命名
  • 支持特色图片使用图片处理

2020-04-22

  • 增加金融云地域
  • 升级SDK至v2.0.8

2020-04-10

  • 修复勾选不在本地保存图片后媒体库显示默认图片问题
  • 修复删除错误

2020-04-02

  • 修复勾选不在本地保存图片后媒体库显示默认图片问题
  • 优化删除文件逻辑

2020-04-01

  • 增加腾讯云数据万象图片处理

2020-03-29

  • 优化deactivation_hook,禁用时可选删除配置和恢复URL前缀

2020-03-27

  • 增加插件禁用事件,可选择是否删除配置
  • 增加上传文件try catch,提示文件上传错误时请打开控制台查看对应请求的Response输出信息
  • 修复首尔地域错误,感谢서대현反馈

2020-03-11

  • 更新腾讯云SDK至v2.0.7版本
  • 修改上个版本插件文件末尾空白符号问题

2020-02-16

  • 更新腾讯云SDK至v2.0.6版本

2020-02-09

  • 增强存储桶配置验证
  • cos client增加schema
  • 修复腾讯云cos返回数据格式不一致问题

2020-01-15

  • 升级sdk为v5版本
  • 修复本地文件夹和URL前缀结尾/去除失败
  • 优化URL前缀注意事项提示中的http和https

2020-01-14

  • 优化button按钮样式
  • 优化sdk中的代码

v4 sdk的最后一个版本

2020-01-09

  • 修复第一次删除文件失败,报错ERROR_PROXY_APPID_USERID_NOTMATCH,导致删除文件不完整
  • 优化删除逻辑
  • 移除时区设置
  • 增加发布版本链接
  • 修改README中的常见问题

2019-11-23

  • 修复地域选择上海地区跳转华中问题

2019-11-13

  • 修复导致评论时间戳差 8 小时问题

2018-11-30

  • 增加数据库链接替换功能

2018-11-04

  • 添加北京、香港、法兰克福等完整地域使用

2018-10-30

  • 修复变量未定义错误

2018-09-01

  • 新增错误 Case

2018-05-22

  • 接手更新,创建仓库
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

使用腾讯云对象存储服务 COS 作为附件存储空间的WordPress插件 展开 收起
PHP
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/cctvteam/wordpress-qcloud-cos.git
git@gitee.com:cctvteam/wordpress-qcloud-cos.git
cctvteam
wordpress-qcloud-cos
wordpress-qcloud-cos
master

搜索帮助