QiniuResource (Cloud) Storage: used to store static resources such as images and apk. Advantages: 1. qiniu bandwidth and CDN are used, which is fast and does not occupy developer servers. 2. Automatic Generation of images in any format and resolution is supported and can be used as an image server. 3. Free small traffic: 10 GB of storage space and 10 downloads per month
Qiniu Resource (Cloud) Storage: used to store static resources such as images and apk. Advantages: 1. qiniu bandwidth and CDN are used, which is fast and does not occupy developer servers. 2. Automatic Generation of images in any format and resolution is supported and can be used as an image server. 3. Free small traffic: 10 GB of storage space and 10 downloads per month
Qiniu Resource (Cloud) Storage: used to store static resources such as images and apk.
Advantages:
1. qiniu bandwidth and CDN are used, which are fast and do not occupy developers' servers.
2. Automatic Generation of images in any format and resolution is supported and can be used as an image server.
3. Free small traffic: 10 GB of storage space, 10 GB of download traffic per month, 0.1 million PUT/DELETE requests per month, and 1 million GET requests per month. When the project grows, more traffic is required for purchase. Suitable for Internet entrepreneurs.
4. webp is supported, the image quality remains unchanged, and the image size is greatly reduced. It is especially suitable for image servers for mobile Internet apps.
For example:
Source image 103KB: http://com-163-sinkcup.qiniudn.com/6ffe255fab20747c8872638870268703
Automatic 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
Qiniu official php sdk:
Http://docs.qiniu.com/php-sdk/v6/index.html
For this third-party library, PHP officially calls it PEAR and needs to be developed according to the PEAR standard (Standard URI ).
PEAR advantages: one-click installation to the php/lib/php Directory, require can be used, very convenient.
Because the official php sdk of qiniu is not developed in accordance with the PEAR standard and is inconvenient to use, I have developed one. The installation steps are as follows:
pear channel-discover sinkcup.github.io/pearpear install sinkcup/Services_Qiniu
Procedure:
1. register an account with qiniu (http://www.qiniu.com/) to create a bucket space.
2, demo (reference https://github.com/sinkcup/php-sdk/blob/pear/tests/Services/Qiniu/RSTest.php ):
'foo', 'secretKey' => 'bar',);require 'Services/Qiniu/RS.php';$c = new Services_Qiniu_RS('com-example-img-agc', $conf);$headers = array( 'Content-Type' => 'image/jpeg',);$r = $c->uploadFile('/home/u1/2.jpg', '/2.jpg', $headers);var_dump($r);?>
Output:
array(1) { ["uri"]=> string(40) "http://com-163-sinkcup.qiniudn.com/2.jpg"}
Official php sdk source code:
Https://github.com/qiniu/php-sdk
After fork, my Services_Qiniu source code:
Https://github.com/sinkcup/php-sdk/tree/pear
PEAR channel:
Http://sinkcup.github.io/pear/