If i try to move to the same directory - Pictures - (but with jpg extension instead of png, it crashes my companion (Android 10)
The camera image starts in the Pictures folder, so I do not need to create it ?
Crashes on Android 12 (real device) too
Ah, I think I see, the file block does not want a full file path....
Create what?
I created a new folder in my first example (blocks), as I decided to move the picture there (in a new sub-folder of ASD (/myPic
).
But in my second example I only moved the png file to a jpg file (pic1.jpg).
My app doesn't crash on Android 10, 11, 12.
Post your aia.
Did you test with my aia (CameraTest.aia
)?
This is (almost) the same as I've shown.
For others:
The File1.MoveTo
block starts at the ASD/files (when filescope is set to App
)
/storage/emulated/0/Android/data<packageName>/files
The camera image
block returns a full file path
file:///storage/emulated/0/Android/data<packageName>/files/Pictures/appinventor_123456789.png
I had forgotten this, until @Anke kindly reminded me to remove the matching part of the camera image'
s path (and the file://
at the beginning)
just leaving
/Pictures/appinventor_123456789.png
to apply to the File1.MoveTo
block's toFilename
sockets
but still i am unable to resize the photo, is there any add on which able to resize the photo? or maybe i get wrong
i've followed your block, and it didn't show any result like the resized images, is there anything wrong with it?
could you give me all of your blocks, bcz i still have no idea to handle it.
Hi @Anke, i've already tested your aia, and when i used it, the image size on your aia is around 10 kB. so i tried it on my app and made it like yours (but in resize block i make it around 320*240) but the result is around 895 kB and the resolution still 2640x1488 px. and the photo unable to uploaded to my google script, is there something that i did wrong?
In order to:
- Take a Picture
- Rename that picture to have a jpg extension (this handles a naming bug in AI2 at time of writing)
- Resize the picture (using Taifun's Image extension)
- Convert picture to a base64String (using Juan Antonio's Base64 extension)
- Upload the picture to Google Drive (using the script below, and a designated folder)
- We know the mime-type will be jpeg because we have a .jpg image file
- We use the camera assigned filename because of the timestamp
...
SCRIPT
function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
var fileID = DriveApp.getFolderById(e.parameters.folderId).createFile(blob).getId();
return ContentService.createTextOutput(fileID);
}
...
Hi there!
I've followed your blocks and script but still I couldn't uploaded it on Google Drive Folder, is there something wrong?
Sorry if i may irritated you guys, it's my first time to make the app and have zero experiences, and I'm glad this community could help me :')
here's the result from my phone (Samsung S9)
This is an error from your blocks - somewhere - you will need to debug your workflow to find where the error occurs
I've followed the blocks exactly as yours to make dummy, ensure where did I went wrong. but still nothing's happen.
I do really need your help, i've tried but still nothing happened. and unable to resize the images cause a lot of time to remove it one-by-one to prevent my drive "full capacity".
and this is the script