2.0.2 • Published 8 years ago

wixmedia v2.0.2

Weekly downloads
87
License
MIT
Repository
-
Last release
8 years ago

wixmedia-js SDK

Wix Media Platform is a collection of services for storing, serving, uploading, and managing image, audio, and video files.

This package is an isomorphic JavaScript library (works in Node and in the browser) that provides a convenient API to access Wix Media Platform image manipulation APIs.

Prerequisites

To begin working with Wix Media Platform:

Installation

Using npm

$ npm install wixmedia

Using bower

$ bower install wixmedia

Usage

Image Manipulation

Node.js

var BASE_URL = "<your base URL here>";
var WixImage = require('wixmedia').WixImage;
var image = WixImage(BASE_URL, "<your image ID here>", "<image_name>");
var fit = image.fit().w(1000).h(1000);
//prints out the new URL for an image that has width of 1000px and height of 1000px
console.log(fit.toUrl());

Browser, no AMD

var BASE_URL = "<your base URL here>";
var image = wixmedia.WixImage(BASE_URL, "<your image ID here>", "<image_name>");
var fit = image.fit().w(1000).h(1000);
//prints out the new URL for an image that has width of 1000px and height of 1000px
console.log(fit.toUrl());

Browser, using require.js

require(['WixMedia'], function(WixMedia) {
    var BASE_URL = "<your base URL here>";
    var image = wixmedia.WixImage(BASE_URL, "<your image ID here>", "<image_name>");
    var fit = image.fit().w(1000).h(1000);
    //prints out the new URL for an image that has width of 1000px and height of 1000px
    console.log(fit.toUrl());
});

###Image Uploading, Node only

####Node.js with Callbacks

var API_KEY = "<API KEY>";
var API_SECRET = "<SECRET_KEY>";
var wixmedia = require("wixmedia");

var uploader = wixmedia.uploader(API_KEY, API_SECRET);
uploader.images().uploadFromFile("files/images/wixLogo.jpg", function(data) {
  console.log("New image created:" + data.imageId);
}, function(error) {
  console.log(error);
});

####Node.js with Promises

var API_KEY = "<API KEY>";
var API_SECRET = "<SECRET_KEY>";
var wixmedia = require("wixmedia");

var uploader = wixmedia.uploader(API_KEY, API_SECRET);
uploader.images().uploadFromFile("files/images/wixLogo.jpg").then(function(data) {
  console.log("New image created:" + data.imageId);
}, function(error) {
  console.log(error);
});

Read the docs

Read the API docs to learn more about this library

Wix Media Platform

Wix Media Platform provides powerful image-processing services that support resizing, cropping, rotating, sharpening, watermarking, and face-detection, as well as offer a number of filters and adjustments.

Learn more about image manipulation here: Wix Media Platform - Images.

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

9 years ago

1.12.0

9 years ago

1.11.0

9 years ago

1.1.0

9 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago