How to convert the picture in the temporary path of wx.chooseImage into binary content in WeChat Mini Programs

how to convert images in the temporary path of wx.chooseImage into binary content in WeChat Mini Programs

because you want to adjust Tencent Cloud"s universal printed OCR character recognition interface, there is such a demand

The address returned after the success of

wx.chooseImage is as follows: "https://img.codeshelper.com/upload/img/2021/06/22/xldyv5era3e18278.jpg"

"

how to convert to binary?
Please answer Daniel, thank you!


Tencent Cloud's general printed OCR character recognition interface supports Base64 format
can introduce a third-party js Base64 coding library to complete coding
dankogai/js-base64


wx.getFileSystemManager (). ReadFile ({
filePath: imgPath,
encoding: 'base64',
})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2983d-15eb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2983d-15eb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?