Pixaven Blog

New External Storage Connector - Alibaba Cloud OSS

New External Storage Connector - Alibaba Cloud OSS

We are always working hard to increase the versatility of the Pixaven Image API. We think our customers, especially those within the Asia-Pacific region, will be pleased with our latest addition to a list of supported external storage providers - Alibaba Cloud OSS. With that integration we now officially support seven providers: AWS, GCP, Azure, IBM, DigitalOcean, Rackspace and Alibaba Cloud.

How to use the new Alibaba Cloud OSS connector

Alibaba Cloud OSS integration follows the same universal pattern we have for all external storage providers. Simply set alibaba as a provider within the storage hash and, at a minimum, provide your Alibaba credentials (key and secret) as well as a bucket name and the Alibaba Cloud OSS region where your bucket is located. The full list of supported regions can be found here. We also support additional parameters for objects in OSS such as Cache-Control headers or metadata.

We have updated our API docs with detailed instructions on Alibaba Cloud OSS.

{
    "store": {
        "provider": "alibaba",
        "key": "your-alibaba-key",
        "secret": "your-alibaba-secret",
        "bucket": "bucket-name",
        "region": "alibaba-oss-region"
    }
}

Here’s a quick example of how to push processed images to Alibaba Cloud OSS with our official Node integration:

const Pixaven = require("pixaven");

/**
* Instantiate `pix`
*/

const pix = new Pixaven("your-api-key");

/**
* Provide a publicly available image URL with fetch(string) method,
* resize it to a maximum of 100 x 75 and instruct the API
* to storage resulting image(s) in Alibaba Cloud OSS
*/

pix
    .fetch("https://www.website.com/image.jpg")
    .resize({
        strategy: "auto",
        width: 100,
        height: 75
    })
    .store({
        provider: "alibaba",
        key: "your-alibaba-key",
        secret: "your-alibaba-secret",
        bucket: "bucket-name",
        region: "alibaba-oss-region"
    })
    .toJSON((err, meta) => {
        if (err) {
            return console.log(err);
        }
    });

Should you have questions about Alibaba Cloud OSS integration or requests for other features do not hesitate to contact us anytime.

About the author

Przemek Matylla is the Founder and CEO of Pixaven currently living in Berlin. You can follow him on Twitter or connect with him on LinkedIn.