PHPPEAR package for Qiniu Cloud Storage: Services_Qiniu_PHP tutorial

Source: Internet
Author: User
Tags webp
PHPPEAR package for Qiniu Cloud Storage: Services_Qiniu. 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. 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//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', 'Services/Qiniu/RS.php' =  Services_Qiniu_RS('com-example-img-agc',  = 'Content-Type' => 'image/jpeg', = ->uploadFile('/home/u1/2.jpg', '/2.jpg', (?>

Output:

(1"uri"]=>  (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/

Alibaba Resource (Cloud) Storage: used to store images, apk, and other static resources. Advantages: 1. Qiniu bandwidth and CDN are used, which is fast and does not occupy developer servers. 2. support...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.