npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rc-cropper

v1.3.1

Published

Cropper as React components

Downloads

17

Readme

rc-cropper

An react component wrapping the Cropperjs.

Cropperjs Docs

Installation

Install via npm

npm install --save rc-cropper

Example

Inspired by react-cropper

import React, {Component} from 'react'
import Cropper from 'rc-cropper'
class Demo extends Component {
  crop(){
    const canvas = this.refs.cropper.getCroppedCanvas()
    const url = canvas.toDataURL() // image url
    const blob = canvas.toBlob(blob => {
      // upload the blob or do anything else
    })
  }

  render() {
    const options = {
      aspectRatio: 16 / 9
    }
    return (
      <Cropper
        ref='cropper'
        src='http://fengyuanchen.github.io/cropper/images/picture.jpg'
        options={options} />
    )
  }
}

Props

name | type | default | description ---|---|---|--- src | string | | image src className | string | | custom class name locale | object | | for i18n zoomStep | number | 0.2 | zoom step moveStep | number | 2px | move step rotateStep | number | 45deg | rotate step onReady | function | | callback when the cropper is ready showActions | bool | false | whether show action buttons, support zoom/move/rotate outputImgSize | object | | specify the output canvas size, format: {width: *, height: *} containerSizeLimit | object | { maxWidth: 500, maxHeight: 500, minWidth: 50, minHeight: 50} | the size limitation of image container cropBoxEditable | bool | true | Whether the cropbox width and height can edit by input. If outputImgSize is set, this property would be invaild options | object | | options for cropperjs

Note:

  • If outputImgSize is specified and no aspectRatio specified in options, rc-cropper will caculate the aspectRatio based on outputImgSize automatically. aspectRation = outputImgSize.width / outputImgSize.height