wix-media-js
The Wix Media JavaScript SDK is an isomorphic library. It works in Node.js and in the browser.
The Wix Media JavaScript SDK is an isomorphic library: it works in Node.js and in the browser. The SDK provides a convenient API to access the Wix Media Services image manipulation APIs. Learn more​

Before you begin

You need to sign in to Wix Media Manager to create an account and you need to prepare a Google Compute Engine virtual machine instance to host your Node.js application.
    1.
    ​Create a Wix Media Platform account by connecting with your Google account. You can then upload media files to Wix Media Platform through the Media Manager or by using various widgets, APIs, and the Wix Media JavaScript SDK or Python SDK.
    2.
    After signing in, copy the API Key and API Secret values. You will add these to your code to authenticate with the Wix Media Platform.
    4.
    After your instance is configured, connect to it using SSH. You can connect using SSH from the browser or you can use the gcloud compute ssh [INSTANCE_NAME] command.
    5.
    After Node.js is configured on your system, install the Wix Media JavaScript SDK by using the following command:
    1
    npm install wixmedia
    Copied!
You now have a virtual machine instance running Node.js with the Wix Media JavaScript SDK installed.

Manipulating images

The following example shows how to manipulate an image using Node.js and the Wix Media JavaScript SDK.
1
var BASE_URL = "media.wixapps.netggl-685734655894940532967/images/";
2
var imageId = "ae1d86b24054482f8477bfbf2d426936"
3
var image = WixMedia.WixImage(BASE_URL, imageId, β€œcats.jpg”);
4
var crop = image.crop().w(1000).h(1000).x(100).y(100);
5
// prints out the new URL for an image that has width of 1000px and height of 1000px, cropped from 100, 100
6
console.log(crop.toUrl());
Copied!
The Wix Media JavaScript SDK also provides native JavaScript support that you can use in other runtimes, such as in an App Engine application or other types of Compute Engine deployments. Learn more about the Wix Media JavaScript API.

Additional resources

Last modified 7mo ago