I have an image encoded as base64 blob that I can serve up successfully from Google Apps Script - as per this jsfiddle
I'm trying to now save this as an image on Google Drive using Google apps script. Although I can write the file, and when I download it access it, it is indeed an image, the google docs viewer cannot preview it. Here's the code to save it - which works, and correctly reports the content type as image/png.
function writeToDrive() {
var blobOb = blobObGet("googleLogoBlob");
if (!blobOb.error) {
var imgBlob = Utilities.newBlob(Utilities.base64Decode(blobOb.blob),"image/png",blobOb.name + ".png" );
Logger.log (imgBlob.getContentType());
var file = DocsList.createFile(imgBlob);
}
}
How do I access the file metadata from google apps script so as to set the correct mime/type for the the google docs viewer ?