How Can I Change Image Size With Photo Picker for Uploading Image Google Drive

Hello. I want to upload photos to Google Drive using image picker. I select the photo from the gallery, but I cannot change its size. (file size very big , for example: 6 mb, i want 1,5-2 mb file size) File sizes become very large. For example, I want to set the photo size to 1080*1600. I looked at dozens of examples and articles, but I couldn't find even one example showing how to do this when using image picker. And also can you help me upload multiple files to Google Drive at the same time using image picker? Thanks.

I added my blocks here..

[Old extension]
com.sunny.cmprs.aix (5.7 KB)

size in kb like 200 for 200 kb
outputDir ~ absolute dir path like /storage/emulated/0/Pictures/

2 Likes

Thanks vknow360. Is there any example for this extension.

Sure.

unfortunately I was not successful. To wehere will i add this block? Can You help me please?

You should show your blocks.

Of course.

This is my block

Are filePath and outputPath valid?

Yes they are valid, but im not sure for file names. files names will be variable for every file

They are not.
First of all you are missing a leading / in path before storage.
Secondly, it was my mistake to use wrong input in outputDir parameter.
Change it to something like /storage/emulated/0/DCIM/Camera/compressed.
It must be different from filePath.

1 Like

I tried as you said and it doesn't work. Here is the code block. I don't know exactly where to place the code block

File path should point to a file, not folder.

sorry, it is not happening. file names will be given automatically by the way

Then it's your job to figure out how to get correct file path.

1 Like

I found my problems solution at here post no 10 :slight_smile:

Now i can save pictures to my phones gallery.

Thank a lot @Anke