


Cloud Storage: Comparison between Alibaba Cloud and Qiniu_PHP Tutorial
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>
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>
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>
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>
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
|
|||||||||||||
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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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 "Connect and Share" or "Wireless & Networks" option. Step 3: In the Connection & Sharing or Wireless & Networks menu, find and click "NFC & Payments". Step 4: Find and click "NFC Switch". Normally, the default is off. Step 5: On the NFC switch page, click the switch button to switch it to on.

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

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.

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.

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

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

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 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
