Can I reduce the resolution of image files?

The simple question is: Does the Android 4.1.x device request storage permissions? Yes or no?

(Uninstall & reinstall the app and check.)

Of course, on Android < 23 permissions are requested and granted at install-time and not at runtime. So check if storage permissions are granted in the app Settings (or if they are declared in the Manifest).

Thanks Anke.
Yes. At least the last 2 times, I uninstalled an reinstalled the app again (this is when I took the photos atached to former post).
Sorry. I don't know how to read a manifest.
When looking at the app's permissions (in the Apps Manager of the device), I can see the same ones mentioned at installation time.
I supose the File component, or the Web component that are present in the app, automatically includes the request of such permissions for me.
I supose what we are looking for is "Probar acceso al almacenamiento protegido".

By the way... The issue is in the device with Android 4.2.2.
Not in 4.1.1 nor 11

Thanks Tim
I modified to lower case and switched the positions of the request headers and web url.
Still the same results.

Let me check the APK. Upload it to Google Drive and post the link.

I think I found the reason for the 1104 issue!
It looks that I was deleting the file from local storage too soon: Just after requesting it's upload to the cloud (which takes some time).
I didn't discover it up to now, because in all three tablets Firebase console told me that the file was there (even with it's smaller size).
But today I discovered that, in the file uploaded with the tablet that gives the 1104 error, I can see only the upper part of the image.
I should have waited for the .GotText 200 confirmation of the upload, before deleting the file from ASD.
Thanks a lot to you all for your help.

I'm uploading to the cloud the converted file, just after converting it to smaller size with the .Resize block of your extension.
Now I think may be the RunTime Error I got with old tablets and big files, were not due to hitting the limits of memory of the tablet, but due to not having finished the conversion yet, when I ordered the upload.
To avoid timing issues when converting files of big sizes ¿do you recommend me to wait some time in between?

That seems a sensible thing to do. When I get a moment, I will look to adding some "after conversion" / "after resizing" event blocks to the extension, so that you can be sure the conversion/resize is finished before continuing with the workflow.

What you could also try is to use the if File exists block to test for the existence of your output file...

1 Like

Nice patch: Change the name of the converted file, and test if it's there before going on.

An after resizing event block will be really wellcome.

Checking if the converted file exist, is easier to tell than to do:
First your need to handle a double file name (and file path), to diferentiate the original from the converted.
If you check, and the converted file still is not there, you need to set a timer to recheck. ¿How often, and how many times?
If there is a chance that you are converting asinchronously more than one file, you'll also need to handle a list of files pending to be converted.

It would be much easier if there was an after resizing block, that tells you the name (better the full path) of the file just resized.

Here you are Martin, try this, let me know how it goes...
Events for conversion and resize, returns the filePath (same as the "output" you supply) (9.0 KB)

1 Like

Great TIM. Thanks a lot. It's very usefull.
I tested the .AfterImageResized block and it works.
Now we can be sure of not having timing issues.

Unfortunatelly my old tablets can't resize big files (their limit is somewhere between 1 and 2 MB, but sometimes they succed whith some 3 MB file).
But companion told me the Runtime Error it's due to lack of memory.
I'm ordering a new tablet, with more power and Android11.

A couple of updated extensions for you to test/try

ImageConvertor, which now returns file sizes for target and output, and a formatted option (10.1 KB)

FileSize which returns the file size of a file, as bytes or formatted (4.7 KB)

Works for me.

Resize_7.aia (13.0 KB)

1 Like

Thanks Tim.
Nice to have new features.
I tested the .Resize and .AfterImageResized blocks, and they work as expected.

Just a little suggestion (to get close to perfection, in case your keep improving the extension):
To order the same way both the event type and the procedure type blocks in the drawer (I made a mistake, and dragged the .AfterImageConverted block instead)

I have no control over that, AppInventor sorts methods and events blocks, although it is odd that they are not alphabetical. I will try AfterResizeImage / AfterConvertImage see if that makes a difference.

Here you are :wink:

image (10.1 KB)

1 Like


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

With the release of version 190 / 190a, the camera picture is now, once again, returned as a file with the .jpg extension, (instead of a png).

1 Like