Welcome,

The Widget API: Constructor

Constructor option properties

Parameter Type Value
selector

string

A CSS selector that matches a single element in the HTML

options

object

Parameter Type Value
message

string

A string to display when there is no image to display in the widget.

headers

object

An object of name-value pair strings to use in widget requests.

cropOnRender

boolean

Whether or not to display the crop tool after render

cropWidth

number

The initial width of the crop tool

cropHeight

number

The initial height of the crop tool

appId

string

See the setup section

index.html

<html lang="en"> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta http-equiv="X-UA-Compatible" content="ie=edge"/> <title>TWEEKIT EXAMPLE</title> </head> <body> <!-- Creating headshots for all employee photos made easy--> <div id="canvas0"></div> <script src="tweekit-widget.min.js"></script> <script src="script.js"></script> </body> </html>

script.js

var options = { appId: '{ your app ID }', message: 'drop or click to upload image', cropWidth: 500, cropHeight: 500, cropOnRender: true, header: { 'Referrer Policy': 'strict-origin-when-cross-origin' } } var tweekit = new Tweekit('#canvas0', options})