Home php教程 php手册 云存储:阿里云 和 七牛 的比较

云存储:阿里云 和 七牛 的比较

Jun 13, 2016 am 11:31 AM
http rest cloud and Basic storage standard Compare of Ali

结论:

  阿里云存储 七牛云存储
标准:REST、HTTP 99%符合 50%
基本功能:送二级域名、绑定域名、CDN 支持 支持
自定义文件HTTP header 支持 少量支持
高级服务:图片处理 不提供 很完善地提供
收费策略 收费 小流量免费。大流量收费。
官方PHP SDK 差,依赖亚马逊http库,而不是PHP官方PEAR HTTP_Request2

把阿里云存储官方混乱的PHP SDK 重写成PEAR,然后作为apk下载使用。

然后想把图片服务器也迁移到云存储,这样不占用VPS带宽。这时候才发现 阿里云OSS 只有最简单的文件存储功能,不支持图片处理。

比如图片服务器最常用的功能:

1、上传一张原图,实时自动生成任意分辨率的各种图片

比如原图

http://example.com/2.jpg

然后请求任意分辨率,请求时服务器自动生成并输出,比如

http://example.com/2.jpg?resolution=1280x720

2、格式自动转换

比如http://example.com/2.jpg?format=png

 

由于阿里云存储不支持图片功能,所以不能用了。考虑迁移到七牛。

参考七牛官方PHP SDK,重写成PHP PEAR包,发现七牛API不是REST。

API对比如下:

  阿里云存储 七牛云存储
上传文件 HTTP PUT 资源URI HTTP POST up.qiniu.com
删除文件 HTTP DELETE 资源URI HTTP POST rs.qbox.me
认证 HTTP header Authorization 一会儿使用HTTP header Authorization,一会儿使用POST token

阿里云存储 API CURL demo:

上传文件:

curl -i -X <span '</span><span PUT</span><span '</span> -T <span '</span><span 1.jpg</span><span '</span> <span '</span><span http://com-163-sinkcup.oss.aliyuncs.com/1.jpg</span><span '</span> -H <span '</span><span Authorization: OSS asdf:qwer</span><span '</span> -H <span '</span><span Content-Type:image/jpeg</span><span '</span>
Copy after login

curl -i -X <span '</span><span DELETE</span><span '</span> <span '</span><span http://com-163-sinkcup.oss.aliyuncs.com/2.jpg</span><span '</span>
Copy after login

七牛云存储 API CURL demo:

上传文件(可以看出七牛把bucket放在token认证中,技术上导致七牛无法实现“公共上传”):

curl -i -F <span '</span><span file=@2.jpg</span><span '</span> -F <span '</span><span token=asdf</span><span '</span> -F <span '</span><span key=2.jpg</span><span '</span> <span '</span><span http://up.qiniu.com/</span><span '</span>
Copy after login

curl -i -X <span '</span><span POST</span><span '</span> -H <span '</span><span Authorization: QBox asdf</span><span '</span> <span '</span><span http://rs.qbox.me/delete/com-163-sinkcup:1.jpg</span><span '</span>
Copy after login

 

可以看出:阿里云存储在技术上比较严谨,使用标准REST。七牛有的地方不再使用token,使用了HTTP header Authorization,可能正在改进。

图片功能对比如下:

  阿里云存储 七牛云存储
自动生成任意分辨率 支持
自动生成任意格式 支持
webp 支持,可节约app大量流量

七牛的图片demo:

原图 103KB:http://com-163-sinkcup.qiniudn.com/6ffe255fab20747c8872638870268703

自动生成jpg 79KB:http://com-163-sinkcup.qiniudn.com/6ffe255fab20747c8872638870268703?imageMogr/v2/auto-orient/thumbnail/1366x768/quality/80/format/jpg

自动生成webp 23KB:http://com-163-sinkcup.qiniudn.com/6ffe255fab20747c8872638870268703?imageMogr/v2/auto-orient/thumbnail/1366x768/quality/80/format/webp

由于七牛提供的图片功能及其强大,支持webp对移动互联网省流量特别重要(Android、ios app省70%流量),而且七牛使用go语言,还写了本书(《Go语言编程》豆瓣),说明技术上实力很强,以后会支持REST的,所以最后决定使用 七牛云存储。

阿里云和七牛的PHP SDK都一样不规范,没法用,只能重写。我重写好了,在这里:

七牛云存储PHP PEAR包下载:http://www.cnblogs.com/sink_cup/p/PHP_PEAR_Services_Qiniu.html

阿里云存储PHP PEAR包下载:http://www.cnblogs.com/sink_cup/p/PHP_PEAR_Services_Aliyun_OSS.html

阿里云存储1%不符合标准的地方:

自定义HTTP header使用了小写,不符合HTTP常识。比如阿里云使用x-oss-acl是错误的,应该使用X-Oss-Acl。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to enable nfc function on Xiaomi Mi 14 Pro? How to enable nfc function on Xiaomi Mi 14 Pro? Mar 19, 2024 pm 02:28 PM

Nowadays, the performance and functions of mobile phones are becoming more and more powerful. Almost all mobile phones are equipped with convenient NFC functions to facilitate users for mobile payment and identity authentication. However, some Xiaomi 14Pro users may not know how to enable the NFC function. Next, let me introduce it to you in detail. How to enable nfc function on Xiaomi 14Pro? Step 1: Open the settings menu of your phone. Step 2: Find and click the &quot;Connect and Share&quot; or &quot;Wireless &amp; Networks&quot; option. Step 3: In the Connection &amp; Sharing or Wireless &amp; Networks menu, find and click &quot;NFC &amp; Payments&quot;. Step 4: Find and click &quot;NFC Switch&quot;. Normally, the default is off. Step 5: On the NFC switch page, click the switch button to switch it to on.

Alibaba Cloud announced that the 2024 Yunqi Conference will be held in Hangzhou from September 19th to 21st. Free application for free tickets Alibaba Cloud announced that the 2024 Yunqi Conference will be held in Hangzhou from September 19th to 21st. Free application for free tickets Aug 07, 2024 pm 07:12 PM

According to news from this website on August 5, Alibaba Cloud announced that the 2024 Yunqi Conference will be held in Yunqi Town, Hangzhou from September 19th to 21st. There will be a three-day main forum, 400 sub-forums and parallel topics, as well as nearly four Ten thousand square meters of exhibition area. Yunqi Conference is free and open to the public. From now on, the public can apply for free tickets through the official website of Yunqi Conference. An all-pass ticket of 5,000 yuan can be purchased. The ticket website is attached on this website: https://yunqi.aliyun.com/2024 /ticket-list According to reports, the Yunqi Conference originated in 2009 and was originally named the First China Website Development Forum. In 2011, it evolved into the Alibaba Cloud Developer Conference. In 2015, it was officially renamed the "Yunqi Conference" and has continued to successful move

How to use TikTok on Huawei Pocket2 remotely? How to use TikTok on Huawei Pocket2 remotely? Mar 18, 2024 pm 03:00 PM

Sliding the screen through the air is a feature of Huawei that is highly praised in the Huawei mate60 series. This feature uses the laser sensor on the phone and the 3D depth camera of the front camera to complete a series of functions that do not require The function of touching the screen is, for example, to use TikTok from a distance. But how should Huawei Pocket 2 use TikTok from a distance? How to take screenshots from the air with Huawei Pocket2? 1. Open the settings of Huawei Pocket2 2. Then select [Accessibility]. 3. Click to open [Smart Perception]. 4. Just turn on the [Air Swipe Screen], [Air Screenshot], and [Air Press] switches. 5. When using it, you need to stand 20~40CM away from the screen, open your palm, and wait until the palm icon appears on the screen.

How to set line spacing in WPS Word to make the document neater How to set line spacing in WPS Word to make the document neater Mar 20, 2024 pm 04:30 PM

WPS is our commonly used office software. When editing long articles, the fonts are often too small to be seen clearly, so the fonts and the entire document are adjusted. For example: adjusting the line spacing of the document will make the entire document very clear. I suggest that all friends learn this operation step. I will share it with you today. The specific operation steps are as follows, come and take a look! Open the WPS text file you want to adjust, find the paragraph setting toolbar in the [Start] menu, and you will see the small line spacing setting icon (shown as a red circle in the picture). 2. Click the small inverted triangle in the lower right corner of the line spacing setting, and the corresponding line spacing value will appear. You can choose 1 to 3 times the line spacing (as shown by the arrow in the figure). 3. Or right-click the paragraph and it will appear.

The difference and comparative analysis between C language and PHP The difference and comparative analysis between C language and PHP Mar 20, 2024 am 08:54 AM

Differences and comparative analysis between C language and PHP C language and PHP are both common programming languages, but they have obvious differences in many aspects. This article will conduct a comparative analysis of C language and PHP and illustrate the differences between them through specific code examples. 1. Syntax and usage: C language: C language is a process-oriented programming language, mainly used for system-level programming and embedded development. The syntax of C language is relatively simple and low-level, can directly operate memory, and is efficient and flexible. C language emphasizes the programmer's completeness of the program

How to use Xiaomi Mi 14 Ultra AI smart image expansion? How to use Xiaomi Mi 14 Ultra AI smart image expansion? Mar 16, 2024 pm 12:37 PM

The progress of the times has made many people's incomes higher and higher, and the mobile phones they usually use will be changed frequently. The Xiaomi Mi 14 Ultra recently launched by Xiaomi must be familiar to users. It has very high performance configuration and can provide users with more In order to provide a comfortable and smooth experience, new mobile phones will inevitably encounter many functions that are not used. For example, how to use Xiaomi 14UltraAI smart image expansion? Come and take a look at the usage tutorial below! How to use Xiaomi 14UltraAI smart image expansion? First open Xiaomi 14Ultra, enter the photo album, select the picture you want to enlarge, and enter the photo album editing option. Click Crop Rotate, click Crop, and click Smart Expand in the selection that appears. Finally, choose the way to expand the image according to your own needs.

Git installation process on Ubuntu Git installation process on Ubuntu Mar 20, 2024 pm 04:51 PM

Git is a fast, reliable, and adaptable distributed version control system. It is designed to support distributed, non-linear workflows, making it ideal for software development teams of all sizes. Each Git working directory is an independent repository with a complete history of all changes and the ability to track versions even without network access or a central server. GitHub is a Git repository hosted on the cloud that provides all the features of distributed revision control. GitHub is a Git repository hosted on the cloud. Unlike Git which is a CLI tool, GitHub has a web-based graphical user interface. It is used for version control, which involves collaborating with other developers and tracking changes to scripts and

Alibaba Game Company's 'Lingxi Interactive Entertainment' has changed its leadership and will be replaced by Zhou Bingshu, the producer of 'Three Kingdoms: Strategy Edition' Alibaba Game Company's 'Lingxi Interactive Entertainment' has changed its leadership and will be replaced by Zhou Bingshu, the producer of 'Three Kingdoms: Strategy Edition' Mar 13, 2024 pm 07:55 PM

According to Game Grape, Zhan Zhonghui (Dingdang), the business leader of Alibaba’s gaming company Lingxi Interactive Entertainment, announced in an internal email that he and Chen Wei’an will step down at the end of the fiscal year (March 31). He also revealed that the position will be taken over by Zhou Bingshu (Uncle Cake), the producer of "Three Kingdoms Strategy Edition". The content of the email has not been made public. Dear friends of Lingxi, since its establishment seven years ago, Lingxi Interactive Entertainment has established considerable brand influence in the minds of players through a series of excellent works with the joint efforts of all team members and the full support of the group, and has gradually emerged in the industry. . As the talent echelon is gradually improving, Lingxi’s young people have grown rapidly and are now able to take on the important task of leading Lingxi’s continued development. By the end of this fiscal year, Lao Chen, Chunjiao and I will officially step down from our posts as class committee members and hand over to Bingshu.

See all articles