A Vue Plugin For Image To Upload and Crop
Click button to upload your image
import VueCoreImageUpload from './vue.core.image.upload.vue';
new Vue({
el: '#app',
components: {
'vue-core-image-upload': VueCoreImageUpload
},
data: {
src: 'http://img1.vued.vanthink.cn/vued0a233185b6027244f9d43e653227439a.png',
},
methods: {
},
events: {
imageUploaded(res) {
if (res.errcode == 0) {
this.src = 'http://img1.vued.vanthink.cn/vued751d13a9cb5376b89cb6719e86f591f3.png';
}
}
},
});
<vue-core-image-upload
v-bind:class="['pure-button','pure-button-primary','js-btn-crop']"
v-bind:crop="false" url="./crop.php"
extensions="png,gif,jpeg,jpg">
</vue-core-image-upload>
{{name}}
H | W | X | Y |
---|---|---|---|
{{cropArgs.toCropImgH}} | {{cropArgs.toCropImgW}} | {{cropArgs.toCropImgX}} | {{cropArgs.toCropImgY}} |
<vue-core-image-upload
crop-ratio="1:1"
v-bind:class="['pure-button','pure-button-primary','js-btn-crop']"
v-bind:crop="true"
url="./crop.php"
extensions="png,gif,jpeg,jpg">
</vue-core-image-upload>