xyxiao001 / vue-cropper Goto Github PK
View Code? Open in Web Editor NEWA simple picture clipping plugin for vue
Home Page: https://github.xyxiao.cn/vue-cropper/docs/vue3.html
License: MIT License
A simple picture clipping plugin for vue
Home Page: https://github.xyxiao.cn/vue-cropper/docs/vue3.html
License: MIT License
我先install然后import了,结果报这个错
如题
浏览器兼容性怎么样,有份浏览器支持的列表就更完美了
你可以找一张小图试试,比如200x200的图。剪裁时 明图会跟暗图错开
能否让大尺寸的图片按照原始尺寸初始?或者是50%放大倍数初始化。。
这里有个需求是,用户用手机对着桌子上的文件拍照,然后通过这个上传。部分用户不会去缩放,直接传上来了。原本手机拍出来一个1920X1080的图 变长了一个极小的图。所有的文字都看不清。所以 如果这个插件能实现,当用户选择了图片之后,展示给用户的是一张放大了的,用户就会自己去选择需要截图的位置。
到我们的环境里提示语如下。Uncaught ReferenceError: n is not defined
我现在不知道java后台如何获取这个data值
this.$refs.cropper.getCropData((data) => {
this.$refs.avatarForm.reset();
this.$post(`${this.$url}/teacher/uploadFileToQiniu`,{
imgStream : data
})
.then(res=>{
})
.catch(err=>{
})
})
找了一天用click触发滚轮滚动的事件的方法都没找到
是否支持禁止放大缩小裁剪框,即固定裁剪框大小
例如 1000 * 1000 的图片,放在500 * 500的容器内,裁剪框为250 * 250,裁剪得到的图片大小也为250 * 250。
能否使裁剪后的大小按照比例为 500 * 500
:fixed 跟 :fixedNumber ,,可以写上去
https://github.com/fengyuanchen/cropperjs#options
除了服务器端解决资源跨域 还有没其他办法解决
能否在缩小放大的时候不要把透明背景圈进去
我也看见你的源码里面也有设置相应的img.crossOrigin,但是谷歌浏览器仍然提示跨域。
在手机上图片比例没有铺满,看了cropper文档里面有viewMode,但是在你开发的vue-cropper上好像缺少了这个支持,那么怎么设置viewMode?
用了大佬的插件,然后在我朋友的6s上上传了图片,不显示,截图也无法实现,一个锤子手机也不行。。。
插件可以批量上传吗?我有点没懂呢!
当按原图比例输出时(即 props = true)
1、指定截图尺寸大小
2、指定截图的最大宽度,当截图宽度大于最大宽度时,按照最大宽度输出
html
<VueCropper
ref="cropper"
:img="example2.img"
:outputSize="example2.size"
:outputType="example2.outputType"
:info="example2.info"
:canScale="example2.canScale"
:autoCrop="example2.autoCrop"
:autoCropWidth="example2.width"
:autoCropHeight="example2.height"
></VueCropper>
js
img: 'http://ofyaji162.bkt.clouddn.com/bg1.jpg', // 图片地址
info: false, // 宽高信息
size: 1, // 图片质量
outputType: 'jpeg', // 输出格式
canScale: false, // 底图是否缩放
autoCrop: true, // 自动截图框
// 只有自动截图开启 宽度高度才生效
autoCropWidth: 300,
autoCropHeight: 250,
// 开启宽度和高度比例
fixed: true,
fixedNumber: [1, 1],
图片旋转放大缩小后,怎么进行还原啊?
Translate docs to English please. Thanks.
1.拍完照之后,报错canvas.toBlob is not a function
pfnet/PaintsChainer#51
尝试了下vue-cropper依赖exif-js降级到2.2.0版本也不会报错,但是还是会出现下面的问题
2.用这个方法解决后,没有报错,但是还是无法在剪辑局域正常显示所拍照片
测试机型:iPhone5s(IOS 8.1)、iPhone 7 plus(IOS10.3.3)
上传图片较小时不能放满容器,出现高亮图向右偏差。能否解决或将图片铺满全屏,谢谢!
6s没有这个问题,7p和6p上面问题比较明显。demo上也有这个问题,微信浏览器里拍照上传进行裁剪,会导致页面重新加载。safari里会提示页面出现错误,重新载入。
<template>
<div class="edit-teacher-container">
<Card>
<div slot="title">
<Button type="text" icon="reply" @click.native="returnTeacherPage">返回</Button>
</div>
<Button slot="extra" type="primary" icon="plus-round" @click.native="saveTeacher">保存</Button>
<Row :gutter="16">
<Col span="10">
<Card style="height:500px">
<p slot="title">
<Icon type="person"></Icon>
设置老师头像
</p>
<Button type="primary" @click="modal1 = true">上传文件</Button>
</Card>
</Col>
</Row>
</Card>
<Modal
v-model="modal1"
title="设置老师头像"
width=800
@on-ok="ok"
@on-cancel="cancel">
<vueCropper
ref="cropper2"
:img="example2.img"
:outputSize="example2.size"
:outputType="example2.outputType"
:info="example2.info"
:canScale="example2.canScale"
:autoCrop="example2.autoCrop"
:autoCropWidth="example2.width"
:autoCropHeight="example2.height"
:fixed="example2.fixed"
:fixedNumber="example2.fixedNumber"
></vueCropper>
</Modal>
</div>
</template>
<script>
import vueCropper from 'vue-cropper'
export default {
components:{
vueCropper
},
data () {
return {
modal1: false,
example2: {
img: 'http://ofyaji162.bkt.clouddn.com/bg1.jpg',
info: true,
size: 1,
outputType: 'jpeg',
canScale: false,
autoCrop: true,
// 只有自动截图开启 宽度高度才生效
autoCropWidth: 300,
autoCropHeight: 300,
// 开启宽度和高度比例
fixed: true,
fixedNumber: [1, 1]
}
}
}
</script>
大神,你看看呢
如果有的话就更加完美了!
如题
如何将裁剪的数据传递给服务端,getCropData这个方法返回的只是一个base64编码,getCropBlob这个方法返回的是blob,这个blob数据是裁剪后的图片的流吗?
很多时候希望图片加载完毕后,初始化组件。没有这个方法,很多事情都做不了了
设置canScale: false,
autoCrop: true,
// 只有自动截图开启 宽度高度才生效
autoCropWidth: 320,
autoCropHeight: 200,
// 开启宽度和高度比例
fixed: true,
fixedNumber: [1, 1]
RT,我使用nuxt,为这个组件关闭了ssr,但是还是会在浏览器控制台得到一条警告信息。
The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside
, or missing. Bailing hydration and performing full client-side render.
vue2.2.6 怎么只有裁剪框 没有图片
对于网页上传的图片,不是所有的图片展示方向都是正的。所以有旋转图片会更好一点。
==,上传了一个竖着拍的图片,展示方向是横着。
现在我下载到本地使用这个插件,报错
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.