0

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 ?

4

1 に答える 1

1

残念ながら、これはおそらくjpegに関するこの問題に関連しています... この問題は 2012 年 4 月に投稿されましたが、まだ修正されていません。

于 2012-10-24T13:06:31.877 に答える