Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-advanced-cropper

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-advanced-cropper

The advanced library to create your own croppers suited for any website design

  • 0.14.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45K
decreased by-5.93%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Advanced Cropper

The advanced library that gives you opportunity to create your own croppers suited for any website design

Documentation / Examples / Sandbox

NPM

WARNING: This library is in beta test stage. API can be changed in the future.

Install

npm install --save vue-advanced-cropper
yarn add vue-advanced-cropper

If you would to use CDN read the corresponding documentation section

Usage

import Vue from 'vue'
import { Cropper } from 'vue-advanced-cropper'

new Vue({
  el: '#app',
  data: {
    img: 'https://images.pexels.com/photos/226746/pexels-photo-226746.jpeg'
  },
  methods: {
    change({coordinates, canvas}) {
      console.log(coordinates, canvas)
    }
  },
  components: {
    Cropper
  }
})
<div id="app">
  <cropper
    classname="cropper"
    :src="img"
    :stencilProps="{
      aspectRatio: 10/12
    }"
    @change="change"
  ></cropper>
</div>
/*
  Maybe you need to set the limits for the cropper sizes or its container sizes
  otherwise a cropping image will try to fill all available space
*/
.cropper {
  height: 600px;
  background: #DDD;
}

Cropper

PropTypeDescriptionDefault
srcStringThe cropping image (link / base64)
stencilComponentString, ObjectThe stencil componentRectangleStencil
stencilPropsObjectThe props for the stencil component{}
classnameStringThe optional classname for the root cropper block
imageClassnameStringThe optional classname for the cropping image
areaClassnameStringThe optional classname for the area.
backgroundClassnameStringThe optional classname for the background under the image
debounceString, NumberThe time before change event will be emitted after changes (ms)500
canvasBooleanThe flag that indicates if canvas should be usedtrue
minWidthString, NumberThe minimum width of the stencil (percents)10
minHeightString, NumberThe minimum height of the stencil (percents)10
maxWidthString, NumberThe maximum width of the stencil (percents)10
maxHeightString, NumberThe maximum height of the stencil (percents)10
checkOrientationBooleanThe flag that indicates if EXIF orientation should be checkedtrue
defaultSizeFunctionThe function that returns the default size of the stencilcore.defaultSize
defaultPositionFunctionThe function that returns the default position of the stencilcore.defaultPosition
restrictionsFunctionThe function that returns the restrictions objectcore.percentRestrictions
areaSizeFunctionThe function that determines the area sizecore.areaSize
resizeAlgorithmFunctionThe function that determines the resize algorithmcore.resize
moveAlgorithmFunctionThe function that determines the move algorithmcore.move
EventDescription
changeInvoked on changing of a stencil position / size, after mounting the component and on an image changing

RectangleStencil

PropTypeDescriptionDefault
aspectRatioNumber, String,The aspect ratio
minAspectRatioNumber, String,The minimum aspect ratio
maxAspectRatioNumber, String,The maximum aspect ratio
classnameString,The classname for root block of the stencil component
previewClassnameString,The classname for the preview component
boundingBoxClassnameString,The classname for the bouding box component
handlerComponentString,ObjectThe handler component
handlersObject,The object of handlers that should be visible or hidden.
handlersClassnamesObject,The object of custom handler classnames
lineComponentString,ObjectThe handler component
linesObject,The object of lines that should be visible or hidden.
linesClassnamesObject,The object of custom line classnames

License

The source code of this library is licensed under MIT, the documentation and photos are belong to their respective owners.

Keywords

FAQs

Package last updated on 05 Dec 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc