Comments (4)
目前也需要这个参数,请问你是怎么解决的?
from image-cropper.
你好,请问有办法获取吗
from image-cropper.
通过获取图片和裁剪框位置强行实现了,就是感觉不太优雅😀
getImg(getCallback) {
let query = wx.createSelectorQuery().in(this);
let resourceInfo = new Promise((resolve, reject) => {
query.select('#resource').boundingClientRect(function(rect) {
resolve(rect)
}).exec();
})
let cutInfo = new Promise((resolve, reject) => {
query.select('.content_middle_middle').boundingClientRect(function(rect) {
resolve(rect)
}).exec();
})
this._draw(() => {
wx.canvasToTempFilePath({
width: this.data.width * this.data.export_scale,
height: Math.round(this.data.height * this.data.export_scale),
destWidth: this.data.width * this.data.export_scale,
destHeight: Math.round(this.data.height) * this.data.export_scale,
fileType: 'png',
quality: this.data.quality,
canvasId: this.data.el,
success: (temp) => {
Promise.all([resourceInfo, cutInfo]).then(res => {
getCallback({
origin: {
url: this.data.imgSrc,
width: res[0].width.toFixed(1),
height: res[0].height.toFixed(1)
},
target: {
url: temp.tempFilePath,
width: res[1].width.toFixed(1),
height: res[1].height.toFixed(1),
x: (res[1].left - res[0].left).toFixed(1),
y: (res[1].top - res[0].top).toFixed(1)
}
});
}).catch(err => {
console.log(err)
})
}
}, this)
});
}
from image-cropper.
卧槽,牛逼我这想了好久,一直在找他的返回裁剪框在图片上的相对位置,没往这边考虑过
from image-cropper.
Related Issues (20)
- 同样的配置,安卓裁剪出来的JPG图片很模糊,比IOS差了很多
- 有react H5版本的吗?
- 设置了裁剪框居中对齐,图片向下了,怎么设置图片图片和裁剪框对齐 HOT 1
- 实现思路
- export_scale自适应不同宽度的图片 HOT 1
- 运行慢、卡 HOT 1
- 请问有taro react版吗? HOT 3
- PNG 图片透明底色变成白底了,期待PNG透明底色可以保留
- 如何自动裁切画面正中间 HOT 1
- 请问可以支持下字节小程序吗 HOT 1
- width 和 height 初始化时 高度大于宽,图片不居中
- 裁剪框可以增加四个点吗
- 如何实现一个界面多张图裁切
- 上传npm
- 没有2d版本的?
- 裁剪框的自定义需求/改造帮助 HOT 1
- 压缩后图片有一层白色
- 是否有canvas 2d的开发计划了?
- 可以使用小程序本地资源图片不
- 移动图片或非中心放大图片,旋转后裁剪框内内容不准确,发生偏移
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image-cropper.