Socket
Socket
Sign inDemoInstall

cropro

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cropro

javascript image cropping library


Version published
Weekly downloads
771
decreased by-21.57%
Maintainers
1
Install size
526 kB
Created
Weekly downloads
 

Changelog

Source

[1.6.0] - 2024-02-07

Added

  • statechange event. Use addStateChangeEventListener() method to add a handler for the statechange event.

Readme

Source

CROPRO — image cropping and rotation component for your web apps.

CROPRO is a JavaScript browser library for adding image cropping and rotation functionality to your web applications.

For a more detailed "Getting started" and other docs and tutorials, please refer to the official documentation.

Installation

npm install cropro

or

yarn add cropro

Usage

To add CROPRO to your web application follow these 3 easy steps:

  1. Create an instance of cropro.CropArea by passing a target image reference to the constructor.
  2. Set an event handler for render event.
  3. Call the show() method.

Here's a simple example:

// skip this line if you are importing cropro into the global space via the script tag
import * as cropro from 'cropro';

// create an instance of CropArea and pass the target image reference as a parameter
let cropArea = new cropro.CropArea(document.getElementById('myimg'));

// register an event listener for when user clicks OK/save in the UI
cropArea.addRenderEventListener(dataUrl => {
  // we are setting the cropped result to replace our original image on the page
  // but you can set a different image or upload it to your server
  document.getElementById('myimg').src = dataUrl;
});

// finally, call the show() method and CROPRO UI opens
cropArea.show();

Demos

Check out CROPRO demos here.

More docs and tutorials

CROPRO docs can be found here.

Credits

cropro is using icons from Material Design Icons for its toolbar.

License

Linkware (see LICENSE for details) - the UI displays a small link back to the CROPRO website which should be retained.

Alternative licenses are available through the official website.

Keywords

FAQs

Last updated on 07 Feb 2024

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc