function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.name);
DriveApp.getFolderById("1TzAFe8ZpCHGVoMZiXpDf8I9O2ussXoIa").createFile(blob);
return ContentService.createTextOutput("Picture of " + name +" uploaded");
}
As you can see, the first example uses the camera component to return the when PictureTaken event. The second example (thumbnails) does not create a file, it returns the base64 directly.
If you want to use the image picker (using the first example as a base), you could probably replace the camera blocks with the imagepicker blocks. On Android 13, camera images are saved to the ASD, therefore not available to the image picker, unless you copy them to shared storage.
If DefaultFileScope is set to "App", camera images are saved to the ASD on all Android version. If DefaultFileScope is set to "Legacy" images are saved in /My Documents/Pictues/ but only up to Android 10. On Android 11+ it is of course no longer possible to write / save in an arbitrary folder of the external storage.
Note: Unfortunately, the Camera component does not provide for saving to one of the shared folders if DefaultFileScope = Shared or Legacy is set.
function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var name = e.parameters.name ;
var filename = name + ", Orders of the " + Utilities.formatDate(new Date(), "GMT+8", "EE dd-MM-yyyy HH:mm:ss");
var blob = Utilities.newBlob(data, e.parameters.mimetype, filename);
DriveApp.getFolderById("1vuPyhV7oHje0T-hLsuWbH6VGauUn8OoV").createFile(blob);
return ContentService.createTextOutput("Picture of " + name + " uploaded");
}
To begin with, remove the comma where you make the filename, replace with hyphen or underscore. It would be better to have no spaces in your filename, at all, so use underscores if you need separation.
Yes I modified it only in term of image capture.
I change only the camera block and replace the variable image fom the camera block to the image picker.