获取图片代码
‘var img = `http://${window.location.host}/Upload/`+Forguncy.Page.getCell("jpg").getValue();
function getBase64Image(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.width, img.height);
var ext = img.src.substring(img.src.lastIndexOf(".")+1).toLowerCase();
var dataURL = canvas.toDataURL("image/"+ext);
return dataURL;
}
var image = new Image();
image.src = img;
image.onload = function(){
var base64 = getBase64Image(image);
console.log(base64);
Forguncy.Page.getCell('touxiang').setValue(base64);
} ’
图片上传后的路径:C:\ProgramData\Forguncy\Garimi\6792\WebSite\Upload\Temp
http://${window.location.host}/Upload/`+Forguncy.Page.getCell("jpg").getValue()无法获取到图片
报错:404,应该是图片路径不正确,但是我不知道怎么改
|