Hi, I am trying to create a web-based social app that allows users to upload profile pictures however when I try uploading the picture through the AI component, it disconnects. May I please be assisted?
Peter
October 10, 2022, 11:53am
2
Can you show how you upload the image? Please tell something about the image itself. What is the size in KB or MB?
It might be also be doing with something with the path itself on different Android versions.
From an Android point of view there are an → Internal Storage and an → External Storage .
1. Internal Storage
The Internal Storage can only be accessed with a rooted device.
1.1 The app package is saved in
/data/data/<packageName>/
In order to be able to debug your app, AI2 saves the assets for → Companion on devices with
Android ≥ 10 (API ≥ 29):
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/
Android < 10 :
/storage/emulated/0/Android/data/edu.mit…
That's my code using the tinyweb companion, but I am aware that I might need help with it.
I am not sure if the other two pictures suffice., but I try uploading the picture from my device and the AI component always stops.
The image has a wdth of 50 percent and a height of 20
Peter
October 10, 2022, 3:49pm
6
This is how it is displayed. It says nothing about the size in Kilobytes.
You can only send strings to TinyWebDB. So you would have to encode your image to Base64 and send that string.
Base64 Image To Component
Adds a background image to just about any user interface component in the palette, even those that do not have a built-in image property. If you want to use base64 encoded images, this may provide some flexibility in your block coding and UI design.
Latest version : 1.0
Tested : tested on App inventor 2 (n187d), in companion (2.61u) on Android 10.
Released : 2021-10-29T23:00:00Z (UTC)
Last updated : 2021-10-29T23:00:00Z (UTC)
Built : using the RUSH Exte…
Your tag shouldn't contain a space as far as I know.
TIMAI2
October 11, 2022, 8:49pm
8
Possibly an easier / better extension to use for image conversion to base64
Image To Base64