UNPKG

cut-image-upload

Version:

裁剪图片,自定义裁剪比例,矩形,圆形,不支持椭圆形

19 lines (18 loc) 608 B
import initArea from "./initArea/initArea.js"; import getCutImg from "./getCutImg/getCutImg.js"; const initCutImg = (domId, cutWidth = 200, cutHeight = 200, cutType = "") => { let dom = document.getElementById(domId); //let width = dom.offsetWidth || 385; //let height = dom.offsetHeight || 450; window["cutCoordinate" + domId] = {}; if (cutType === "circle") { //圆 cutHeight = cutWidth; } initArea(domId, cutWidth, cutHeight, cutType); }; //获取生成的裁剪图片,base64 const getImg = (domId) => { return getCutImg(domId); }; export { initCutImg, getImg };