bugfix
This commit is contained in:
parent
03179fa970
commit
1f39d86557
@ -28,6 +28,9 @@ bricks.Image = class extends bricks.JsWidget {
|
|||||||
this.dom_element.style.height = this.height;
|
this.dom_element.style.height = this.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
removeBase64Header(base64String) {
|
||||||
|
return base64String.replace(/^data:[^;]*;base64,/, '');
|
||||||
|
}
|
||||||
base64(){
|
base64(){
|
||||||
const image = this.dom_element;
|
const image = this.dom_element;
|
||||||
// 创建一个画布来绘制图像
|
// 创建一个画布来绘制图像
|
||||||
@ -42,7 +45,8 @@ bricks.Image = class extends bricks.JsWidget {
|
|||||||
ctx.drawImage(image, 0, 0);
|
ctx.drawImage(image, 0, 0);
|
||||||
|
|
||||||
// 获取画布数据并转换为 base64
|
// 获取画布数据并转换为 base64
|
||||||
const dataURL = canvas.toDataURL('image/png'); // 可以根据需要修改图像格式
|
var dataURL = canvas.toDataURL('image/png'); // 可以根据需要修改图像格式
|
||||||
|
dataURL = this.removeBase64Header(dataURL);
|
||||||
console.log(dataURL);
|
console.log(dataURL);
|
||||||
return dataURL;
|
return dataURL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user