Home Backend Development PHP Tutorial Cloud Storage: Comparison between Alibaba Cloud and Qiniu_PHP Tutorial

Cloud Storage: Comparison between Alibaba Cloud and Qiniu_PHP Tutorial

Jul 20, 2016 am 11:15 AM
http rest cloud and Basic storage standard Compare of Ali

Conclusion:

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

Rewrite the official confusing PHP SDK of Alibaba Cloud Storage into PEAR, and then download it as an apk.

Then I want to migrate the picture server to cloud storage so that it does not occupy VPS bandwidth. Only then did I discover that Alibaba Cloud OSS only has the simplest file storage function and does not support image processing.

For example, the most commonly used functions of image servers:

1. Upload an original image and automatically generate various images of any resolution in real time

For example, the original picture

http://example.com/2.jpg

Then request any resolution, and the server will automatically generate and output it when requesting, such as

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

2. Automatic format conversion

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

Since Alibaba Cloud Storage does not support the image function, it cannot be used. Consider migrating to Qiniu.

Refer to Qiniu official PHP SDK, rewrite it into PHP PEAR package, and find that Qiniu API is not REST.

API comparison is as follows:

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

Alibaba Cloud Storage API CURL demo:

Upload files:

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

Qiniu Cloud Storage API CURL demo:

Upload files (it can be seen that Qiniu puts the bucket in the token authentication, which technically prevents Qiniu from achieving "public upload"):

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

It can be seen that Alibaba Cloud Storage is technically rigorous and uses standard REST. Qiniu no longer uses tokens in some places, but uses HTTP header Authorization, which may be being improved.

The picture function comparison is as follows:

Alibaba Cloud Storage Qiniu
  阿里云存储 七牛云存储
自动生成任意分辨率 支持
自动生成任意格式 支持
webp 支持,可节约app大量流量
Cloud Storage
Automatically generate any resolution None Support
Automatically generate any format None Support
webp None Supported, can save a lot of app traffic

Qiniu’s picture demo:

Original image 103KB: http://com-163-sinkcup.qiniudn.com/6ffe255fab20747c8872638870268703

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

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

Because the image function provided by Qiniu is extremely powerful, supporting webp is particularly important for saving traffic on the mobile Internet (Android and ios apps save 70% traffic), and Qiniu uses the Go language and wrote a book ("Go Language Programming》Douban), indicating that it is technically very strong and will support REST in the future, so I finally decided to use Qiniu Cloud Storage.

The PHP SDKs of Alibaba Cloud and Qiniu are both non-standard and cannot be used, so they can only be rewritten. I rewrote it, here it is:

Qiniu Cloud Storage PHP PEAR package download: http://www.cnblogs.com/sink_cup/p/PHP_PEAR_Services_Qiniu.html

Alibaba Cloud Storage PHP PEAR package download: http://www.cnblogs.com/sink_cup/p/PHP_PEAR_Services_Aliyun_OSS.html

1% of Alibaba Cloud Storage does not meet standards:

The custom HTTP header uses lowercase letters, which is inconsistent with HTTP common sense. For example, it is wrong for Alibaba Cloud to use x-oss-acl, and X-Oss-Acl should be used.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440204.htmlTechArticleConclusion: Alibaba Cloud Storage Qiniu Cloud Storage Standard: REST, HTTP 99% complies with 50% Basic functions: get two free Level domain name, bound domain name, CDN supports custom files, HTTP header supports less...
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)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months 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.

TrendX Research Institute: Merlin Chain project analysis and ecological inventory TrendX Research Institute: Merlin Chain project analysis and ecological inventory Mar 24, 2024 am 09:01 AM

According to statistics on March 2, the total TVL of Bitcoin’s second-layer network MerlinChain has reached US$3 billion. Among them, Bitcoin ecological assets accounted for 90.83%, including BTC worth US$1.596 billion and BRC-20 assets worth US$404 million. Last month, MerlinChain’s total TVL reached US$1.97 billion within 14 days of launching staking activities, surpassing Blast, which was launched in November last year and is also the most recent and equally eye-catching. On February 26, the total value of NFTs in the MerlinChain ecosystem exceeded US$420 million, becoming the public chain project with the highest NFT market value besides Ethereum. Project Introduction MerlinChain is an OKX support

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

See all articles