Gathering detailed insights and metrics for vue-croppie-extended
Gathering detailed insights and metrics for vue-croppie-extended
Gathering detailed insights and metrics for vue-croppie-extended
Gathering detailed insights and metrics for vue-croppie-extended
npm install vue-croppie-extended
Typescript
Module System
Node Version
NPM Version
HTML (55.57%)
JavaScript (44.43%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
72 Commits
1 Watchers
3 Branches
1 Contributors
Updated on Apr 20, 2018
Latest Version
1.0.3
Package Id
vue-croppie-extended@1.0.3
Unpacked Size
327.99 kB
Size
84.34 kB
File Count
12
NPM Version
5.8.0
Node Version
9.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
VueCroppie is a Vue 2 wrapper for Croppie a beautiful photo cropping tool for Javascript by foliotek.
npm install vue-croppie --save
https://unpkg.com/vue-croppie/dist/vue-croppie.js
import Vue from 'vue';
import VueCroppie from 'vue-croppie';
Vue.use(VueCroppie);
1<script src="https://unpkg.com/vue-croppie/dist/vue-croppie.js"> 2<body> 3 ... 4</body> 5<script> 6 Vue.use(VueCroppie.default); 7 8 const vm = new Vue({...}); 9</script>
This sample below will produce this.
<template>
<div>
<!-- Note that 'ref' is important here (value can be anything). read the description about `ref` below. -->
<vue-croppie
ref=croppieRef
:enableOrientation="true"
@result="result"
@update="update">
</vue-croppie>
<!-- the result -->
<img v-bind:src="cropped">
<button @click="bind()">Bind</button>
<!-- Rotate angle is Number -->
<button @click="rotate(-90)">Rotate Left</button>
<button @click="rotate(90)">Rotate Right</button>
<button @click="crop()">Crop Via Callback</button>
<button @click="cropViaEvent()">Crop Via Event</button>
</div>
</template>
<script>
export default {
mounted() {
// Upon mounting of the component, we accessed the .bind({...})
// function to put an initial image on the canvas.
this.$refs.croppieRef.bind({
url: 'http://i.imgur.com/Fq2DMeH.jpg',
})
},
data() {
return {
cropped: null,
images: [
'http://i.imgur.com/fHNtPXX.jpg',
'http://i.imgur.com/ecMUngU.jpg',
'http://i.imgur.com/7oO6zrh.jpg',
'http://i.imgur.com/miVkBH2.jpg'
]
}
},
methods: {
bind() {
// Randomize cat photos, nothing special here.
let url = this.images[Math.floor(Math.random() * 4)]
// Just like what we did with .bind({...}) on
// the mounted() function above.
this.$refs.croppieRef.bind({
url: url,
});
},
// CALBACK USAGE
crop() {
// Here we are getting the result via callback function
// and set the result to this.cropped which is being
// used to display the result above.
let options = {
format: 'jpeg',
circle: true
}
this.$refs.croppieRef.result(options, (output) => {
this.cropped = output;
});
},
// EVENT USAGE
cropViaEvent() {
this.$refs.croppieRef.result(options);
},
result(output) {
this.cropped = output;
},
update(val) {
console.log(val);
},
rotate(rotationAngle) {
// Rotates the image
this.$refs.croppieRef.rotate(rotationAngle);
}
}
}
</script>
All Croppie options were converted to props to be able use them in the vue-croppie
component.
Usage
1<vue-croppie 2 ref=croppieRef 3 :enableOrientation="true" 4 :mouseWheelZoom="false" 5 :viewport="{ width: 200, height: 200, type: 'circle' }" 6 @result="fn" 7> 8</vue-croppie>
All of the properties and methods are based on Croppie documentation. All property and method names are "==="
the same if you know what I mean.
Except for these few things below.
Option | Type | Default | Description |
---|---|---|---|
ref (required) | Object | none | ref is used to create a reference to the child component, in order to have access to it's methods and properties. Specific example is to access the result() function of vue-croppie from outside the component. |
resultType | String | base64 | The image encoding of the cropped image via result() . Also available in Croppie Documentation. |
customClass | String | none | You can pass a custom class or classes to the props customClass like customClass="class1 class2 class3" |
Option | Type | Usage | Description |
---|---|---|---|
update | function | @update="fn" | Gets triggered when the croppie element has been zoomed, dragged or cropped |
result | function | @result="fn" | Gets triggered when the image has been cropped. Returns the cropped image. |
Note:
@result
event is only available if NO callback function was passed to this.$refs.croppieRef.result({})
. See here
How to clear/destroy coppie?
I added a new method called refresh()
and can be used as this.$refs.croppieRef.refresh()
, but the croppie instance is now being refreshed automatically after every crop()
invocation.
Helpful links #358 - Official croppie page.
1.3.0 - Aug 16, 2017
1.2.5 - Aug 12, 2017
result
event.updated
event.1.2.3
croppie
instance after every crop()
invocation.refresh()
which destroys and re-create the croppie instance.1.2.x
this.$refs.croppieRef.result(options, callback)
.Use and abuse at your own risk.
</p>
with ❤️ by Jofferson Ramirez Tiquez
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
72 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More