Error during compressing images

Hi all,

I have my app ready for use with all help received here and now I am receiving (not all the times) this problem when trying to compress an image when the record is sending to the remote server:

The blocks about this are:

Any clues about where I am wrong?

You will need to use Do It on your img local variable and the filePath in the After Resized Event to see what it going on.

You should empty out the After resized event block to see whether it is the img variable or something after it.

We still do not like your method for setting the img local variable, it should not be necessary.

Ok, I'll do it. Any chance the error comes out because the DADO (image) is empty?

Ok, so I am open to learn about best practices... what should I do in this case? These blocks are inside FOR...EACH to get each record from SQLITE to prepare the record to send to the server.

:question:

I also suggested that you do not need to use sqlite for what you are doing. At the very least, tinydb would be sufficient for your needs.

Yes, I know, but the app is in production already... to make this changes is a little complicated to do right now...

1 Like

Anyway, thanks for all help.

Have you found the issue ?

No, unfortunately. But I am looking here.

Well, I have found the error. The problem is that a user tried to pick up more than 10 images and after this the error came out. I am going to change ImagePicker for this approach:

image

And I think this will solve the problem. I initially thought they were going to put just one line with images, but...

Thanks for all answers.

Use separate ActivityStarters, they get confused...

hummm ok... good to know. Thanks again!!

I have done a re-work using tinydb and two images, just as an example.

tinydbfilepathimagetomysql.aia (58.9 KB)

You will notice in the ActivityStarters that I have used android.intent.action.OPEN_DOCUMENT. This will ensure that a contenturi is returned, which can then be used with the SAF block to save the files to the ASD. You could also use FilePicker instead of ActivityStarter:

image

You can also click on the images to rotate them if required.

Also note the use of the action variable throughout.

I left a tinydb clearTag block for testing purposes.

Credits @vknow360 for his excellent SAF extension
Credits @Kumaraswamy and me for the Image Convertor extension
Credits @ me for the Base64Convertor extension

1 Like

Wow!!! Very impressive!!! I will take a look into your solution very closely. Thanks a lot for your time!