我使用Google appscript创建了一个函数,将base64转换为blob,然后使用blob将文件创建到我的Google驱动器文件夹中。但是,文件已创建但未显示任何图像。
这是我的代码:
function base64toBlob() {
var currentFolder = DriveApp.getFolderById("--My Google Drive ID--");
var base64 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGO0lEQVR42rWW+U9VRxTHD9uzQACfIqBFm6JNlYhLW6MGnuBW3MBYF9JitWlqo9YqLsi+wwNxKQqPRQHlB2WtIoILCs/iwqrIJkJUWk2tpPo3fHvm3qu3LMZXiySfzJ2ZM3O+c86ceRAAeoc/c+9Q+m5BGLXrwgheCuJbjIk5YWPKRv9ZwPS1pPUOp2ebDFpk1etQ93Ijrv8dKBDf0piYEzbCdkQFTF1J2gXhBP3lWah5vhFFj+Ygp8sJmZ2jBeJbjIk5yUbYuvvTmJESYMUhfpp0aTYq/liJo63WONBCEqkKSl/MSTZ6tvWOoL+ISPMuAix8wilFnGJpLGFxNCEgzR7lfSuQ0kjQNxCSmZSB8Jg8d6CJUPH7KnxrGAPPXbRVvhOmC7Bi5f0/5jmj/PFqGDm/tf3f4Oqzr3G8/VPE3SAk3iIkqXB/KEeabZFR5wO+lPeJ6ANTBVjogunQllwXdrgBp7qnIf2eA461OiC/ayoqH69HWqMLYq8T4n5juI01EmJqWUidBbdS//V84QNPkQbhRGuqAFufSEJRlx8ON9kg8Sa9JoFJbbBByX0/RF0jRNcQ4o3mONExGcWPP0cRwy333cS4NJ/R7AofWcA4UwU4+saZI6/NQ5xGIlZgVE+a3TIT4Zf5+5o5CrpnIa/rEylCv9y1Fi33p6Dg/kyeJyTXWb+KgJNJAjQ25LIkmsNptEbEFUIEOwqpIoRdJHYqk1jjgP2VhPQmNxhaJyHpNkno60Ur5z/9zgQcbZiEEF43P5iwIJSeeAfTKiIye5MAs3nbaLJ4zSLL3XHlz3WofhYocfHpemQ1umPPWcLecwy3Qb8SjjV+jKhaToWac25Fuqxw5oEn78EX93kgjC82IrtBB78UjbiQqeK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7b1oy3VEW54TbifYIUsOvZvq/P0IkJ7tzG1yBNqFgHwWkGjPuVff9/cuQOT9ZXMouguc0VXggka9A3J2vl8BmtwgwiuOszMhIpPJ2kGS8xO7xJzKSF9CWyW/HsxnymVbPAidMueh2NqOaAQYLeNkIlpTI/APro4kS6kAbKwAAAAASUVORK5CYII=";
var decoded = Utilities.base64Decode(base64);
var blob = Utilities.newBlob(decoded);
Logger.log(blob); // Returns blob
currentFolder.createFile("A Blob Title", blob, "image/png");
}
提前致谢。
答案 0 :(得分:5)
<style>
ul {
padding: 0;
}
li {
padding: 0.15em 0 0.5em 1.5em;
margin-bottom: 0.2em;
text-indent: 0.4em;
font-weight: bold;
list-style: none;
background-repeat: no-repeat;
background-size: 10px;
background-image: url("https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR_DztL2nlERHrDWBFIyA5dp9sblqn6zt57uoRB4IbAbymgpFskfg");
}
</style>
<ul>
<li>Text</li>
<li>Text</li>
</ul>
放弃一下,我做了类似的事情。希望有所帮助:)