时间:2019-05-04 来源:小程序工厂
神链接在此,哈哈哈~
将你的base64放到下方框框里,点击下方按钮就可以啦~~
网站链接:http://imgbase64.duoshitong.com
如下图所示:
// 我给下完整的方法. 思路: 先把base64格式的图片通过writeFile保存成文件,再调用接口保存到用户手机相册 // this.data.qrcode_base64 是图片的base64内容,可以直接在模板页展示
不知道你说的转成图片是指显示还是需要保存?
显示的话直接用base64的图片链接就可以了:
data:image/png;base64,你的图片base64数据
如果需要把图片下载保存,那么可以尝试一下先用canvas绘制出来再保存
writeFile可以吗?我没试过。。你发个 base64出来我试试呢。。
/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAUADwDASIA
AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA
AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3
ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm
p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA
AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx
BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK
U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3
uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD0t5cO
UOQeg9D04rlNQ1Txdp1ok0i6I/mOkUaoZNzuxwAMkDPf8DXUSZV3DnIOOcdjx/QflXP2WNX8R3dw
AHhsAbaBjtOZTzKemcj5Vz0xnGc1u5yuwikWdd1Z9L06GWBLUyzXCQBpxtRM5O5sdsD/ADjBTSNR
1Sae7gv4IUa1ZF823VvLfcobGG7jIz/vD8c/xM+yO0ju1caVJLi8dBkgcFc9wpPUjnjg56s8LmAX
t9Bo/mvo+zeZZV4E2RlVzglduOoJGB688aqSdS1/6/rqa8q5Ll0avrN5c3jaZBbNZ2kpiJnYh5XX
7wXBIHtu45H0Elz4ic+GRq1uke8qrKrgkBi21gemcfMKxtYTS7bU7pGkvYbmUDdaw7kS8OOOgOQS
SufXPfmtC2sY7LwpHaajHJLBGoaZUBymW3Hoei5ycdlJrepOXK7aMU4rluaFnPrgug95/Zxt8kSC
Dfv6HBGeOuK00WEqDvUZ7cf1rkNLa2/tiFdEac2QRjdr83lgn7p+bndkfl+NdJWVOs7a6mSRoN/x
8exABH5/4U3YrP5bDKrkDP4Giiu6ye/ckpBsDgDPXPep0lZZUXjBx2HcUUVxwbUlYtizoqBmVQCH
x+maawUW0bhRnkfXrRRWsklKX9dRCZIt9w4+YKRjg8VNFDHICzIO3Q+wNFFFJJys/wCtwex//9k=
我发现不好录。。我自己转了个。。是可以的哦。。我刚说错了。。是writeFile.你试试呢
wx.chooseImage({
我不知道你写什么东西啊?你这个应该是上传文件的吧,我是要将base64的数据转成图片显示出来,这就行了
chooseImage我选了个图片,然后转成了base64,然后又把base64又转回了文件啊。。你写的话,直接从 let base64= xxxx这一行开始啊
我这样写就抛出错误了
额。。我没表达清楚,你这里应该是
let base64 = res.data.img