Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 768 Bytes

GETTING_STARTED.md

File metadata and controls

45 lines (32 loc) · 768 Bytes

Getting started

Installation

Node

(recommended)

Run npm install js-cropper --save

var Cropper = require("js-cropper");

ECMAScript 6

import Cropper from "js-cropper";

Usage

Add HTML layout

<div id="crop"></div>

CSS (optional)

<link rel="stylesheet" href="../js-cropper/dist/Cropper.css">

Initialize Image Crop

Finally, we need to initialize Cropper in JavaScript code.

const cropper = new Cropper();
cropper.render("#crop");
cropper.loadImage("/path/to/image.jpg").then(function (crop) {
    console.info("Image is ready to crop.");
});

What next?

Go to API Documentation to learn more about all Cropper API and how to control it.