🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

canvas_crop_img

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas_crop_img

+ import cropper.min.js to your html file ```aidl <script src="path/to/cropper.min.js"></script>

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

js canvas crop img

  • import cropper.min.js to your html file
<script src="path/to/cropper.min.js"></script>

  • import css to your html file
<link rel="stylesheet" href="path/to/cropper.min.css">
  • initialize
var cropper = new Cropper({
    okText: 'confirm', // ok text
    cancelText: 'cancel', // cancel text
    el: 'imgFile', // the parent element id of cropper
    maxFileNumber: 1, // max number of file
    cropperWidth: 150, // initial cropper width
    cropperHeight: 150, // initial cropper height
    imgFileDimension: 80, // dimension of show img,
    fileNumberExceed: 'you can upload 1 file at most', // the remind txt when exceed the maxFileNumber
});
  • get file data
cropper.getFiles(); // {width: number, base64: string, height: number}[]

FAQs

Package last updated on 20 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts