
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
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 0 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.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.