找回密码
 立即注册

QQ登录

只需一步,快速开始

webtkvip

注册会员

1

主题

12

帖子

107

积分

注册会员

积分
107
最新发帖
webtkvip
注册会员   /  发表于:2023-6-20 17:45  /   查看:710  /  回复:1
1金币
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);
}

最佳答案

查看完整内容

大佬,代码实在是不懂哈,可以参考下方的帖子哈 BASE64转JPG https://gcdn.grapecity.com.cn/showtopic-88008-1-1.html (出处: 葡萄城产品技术社区)

1 个回复

倒序浏览
最佳答案
最佳答案
Lay.Li悬赏达人认证 活字格认证
超级版主   /  发表于:2023-6-20 17:45:50
来自 2#
大佬,代码实在是不懂哈,可以参考下方的帖子哈

BASE64转JPG
https://gcdn.grapecity.com.cn/showtopic-88008-1-1.html
(出处: 葡萄城产品技术社区)


回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部