Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ebx-react-cropper
Advanced tools
Cropperjs as React components
Install via npm
npm install --save ebx-react-cropper
You need cropper.css
in your project which is from cropperjs.
Since this project has a dependency on cropperjs, it located in /node_modules/react-cropper/node_modules/cropperjs/dist/cropper.css
or node_modules/cropperjs/dist/cropper.css
for npm version 3.0.0
later
1.0.2 - Updated version of cropperjs used from 1.0.0rc3 to 1.4.1
import React, { Component } from "react";
import Cropper from "react-cropper";
import "cropperjs/dist/cropper.css"; // see installation section above for versions of NPM older than 3.0.0
// If you choose not to use import, you need to assign Cropper to default
// var Cropper = require('react-cropper').default
class Demo extends Component {
_crop() {
// image in dataUrl
console.log(this.refs.cropper.getCroppedCanvas().toDataURL());
}
render() {
return (
<Cropper
ref="cropper"
src="http://fengyuanchen.github.io/cropper/img/picture.jpg"
style={{ height: 400, width: "100%" }}
// Cropper.js options
aspectRatio={16 / 9}
guides={false}
crop={this._crop.bind(this)}
/>
);
}
}
string
null
<Cropper src="http://fengyuanchen.github.io/cropper/img/picture.jpg" />
string
picture
string
null
https://github.com/fengyuanchen/cropperjs#aspectratio
https://github.com/fengyuanchen/cropperjs#dragmode
https://github.com/fengyuanchen/cropperjs#setdatadata
https://github.com/fengyuanchen/cropperjs#scalexscalex
https://github.com/fengyuanchen/cropperjs#scalexscaley
https://github.com/fengyuanchen/cropperjs#enable
https://github.com/fengyuanchen/cropperjs#disable
https://github.com/fengyuanchen/cropperjs#setcropboxdatadata
https://github.com/fengyuanchen/cropperjs#setcanvasdata
https://github.com/fengyuanchen/cropperjs#zoomto
https://github.com/fengyuanchen/cropperjs#moveto
https://github.com/fengyuanchen/cropperjs#rotateto
Accept all options in the docs as properties. Except previously mentioned options, other options don't take effect after the component mounts.
<Cropper
src="http://fengyuanchen.github.io/cropper/img/picture.jpg"
aspectRatio={16 / 9}
guides={false}
crop={this._crop}
/>
Assign a ref
attribute to use methods
class Demo extends Component {
_crop(){
const dataUrl = this.refs.cropper.getCroppedCanvas().toDataURL();
console.log(dataUrl);
},
render() {
return (
<Cropper
ref='cropper'
crop={this._crop.bind(this)} />
);
}
}
npm run build
npm run build-example
Fong Kuanghuei (fongkuanghui@gmail.com) Andy Neale (andy@echobox.com)
MIT
FAQs
Cropper as React components
The npm package ebx-react-cropper receives a total of 1 weekly downloads. As such, ebx-react-cropper popularity was classified as not popular.
We found that ebx-react-cropper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.