Hi.
I wonder how is it possible to reduce the size of the image file created by the phone when taking a selfie. Modern phones have high resolution cameras, and the image file they create has a big size of several MB. Downloading those files from web storage consumes a lot of data and takes several seconds (depending on the size of the file, and the data conection of the phone in the mobile network). Such a high resolution image is not necessary just to be displayed on a small window of the mobile screen.
May be there is already a low resolution copy of the photo in the phone (like the thumbs in gallery) that I can use.
May be there is a way to configure the resolution of the mobile camera, when it is comanded from my app to take the picture.
Or may be I will need to use an external web service to make a low res copy of the picture in a different folder of cloud storage.
Any clue or advice will be welcome.
Thank you in advance.
Hi TIM
Tanks for offering your extension.
I tried it. But I must be doing something wrong, because I got a Runtime Error (undefined, when running it in the companion).
Could you, please provide some more information on the correct values for the arguments I should enter to the .Resize block?
Regards
Martin.
Hi Taifun.
I tried the .Resize block of your extension.
Something strange happened to me:
For the first couple of times, it worked fine, and I could see in the second image component a much smaller image.
But from the third time on, I got the same size and a message like : "sorry file has to be ,jpg".
The strange thing is, I always downloaded the same target file (a .png one).
Yes. It works.
Despite what the hint in the .Resize block says, It looks that the Output file name has to be different from Target to avoid this error.
Thanks a lot to all of you.
Hi Tim
Sorry for the delay in answering. I'm having some issues to convert big files with a slow mobile conection and lack of memory in my old tablet.
I tested the the Resize block of your V3OW with target=output file names.
It worked fine with a .png and a .jpg file.
I got a RunTime Error with another .jpg one (of some bigger file size, which may be is hitting the limits of memory of my tablet).
Thanks a lot for rewieving your code.
In fact, for me it's not a problem to set up a new name for the local storage of the converted file in the tablet. Because I finally upload the converted file to cloud storage (where there is no problem to overwrite the original file). I just have to delete 2 files from local, instead of one.
Here are my blocks (thanks to TIMAI2 for his ImageConvertor extension, version3, and the .Resize block).
May be they can help somebody who wants to resize a .jpg or .png image file in Google's FireBase Storage.
In my case, is intended to reduce the "wheight" of selfie photograps taken by the high resolution cameras of modern mobile phones, when the user registers in a carpooling service. (The service uses each other pictures to introduce the passengers and car drivers who can travel toghether, because they go in nearly the same direction).
Usage:
Write your FireBase project's name in StorageBD global variable, and the folder's name in Carpeta global variable ("SLF" in my case).
Set in the corresponding Text Boxes the image file name and the desired size for the converted picture, and hit the button.
Resized image file will have the same file name, and will replace the original one in the same folder of cloud Storage.
Someting is wrong with those blocks.
It doesn't delete the file from de ASD on the device (neither in Android11 nor in older versions).
I'm stuck with this for tree days now
¿Can somebody help?
Thanks