The PNG/JPG issue will be fixed in the SDK 31 update.
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.
Strange, this worked for me previously, but I do get the same error if trying to overwrite the file. I will have a look at the code.
Could you please try this version of the extension where target=output
(of course, ensure that target is writeable, e.g. not in assets)
Unfortunately you forgot to provide a screenshot of your relevant blocks...
Yes, the image must be jpg as the error message is trying to tell you
Taifun
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.
Thanks for testing
Thanks a lot Taifun.
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.
Very good, can you attach the aia?
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
Do you need to add a forward slash, /
, before the filename with the Delete block ?
Thanks a lot, TIM.
Now I know what happened:
Web .GotFile fileName gives you the full path on the device storage up to the file name.
That's good for Image .Picture to show the photo (because it requires the full path).
But, according to your advice, I have to give File . Delete the file name I ordered to convert, preceded by a forward slash.
I compiled it and it works: It uploads to the cloud the converted file, and deletes it from ASD.
But another problem arised: It works perfectly in a tablet with Android11, but in other tablet wit an older Android version it gives an Error 1104: Unable to complete the given request with the file....with the specified URL....
Its strange for me because, despite the error, the converted file is uploaded, and then deleted from device.
And there is no such an error displayed on the device with Android11
Which android version is failing, and which request is returning the 1104 code ?
The old tablet that gives the error has 4.2.2 Android version.
The request returning the 1104 code is WebStorage .PostFile (when called by my procedure SubeLowRes).
It’s just a temporary black window displaying this message that appears, but doesn’t prevent the execution of the next block (File1 . Delete).
But it prevents the normal display of "reemplazado selfie low res" message at EtiqResultados label that should happen when WebStorage .GotText event triggers when the 200 code is received from FireBaseStorage as a reply to the PostFile request.
I'm not sure if I set correctly the RequestHeaders for a file upload (which in fact replaces a file with the same name in FireBase Storage). The result is the file is replaced ok in the cloud. But may be the answer is not the expected one?
The extrange thing is it works well in the other tablet with Android11.
In case it can help, I found a similar issue in this post: Can't POST file: Error 1104
I don't know what happens.
I compiled the app again, installed also on a third tablet with Android 4.1.1 and it works fine (no 1104 error in 2 tablets, but it keeps apearing in one of them).
In fact, is not a big problem:
I could simply ignore the black window with the 1104 error, and program the rest of the code for not waiting the response to the .PostFile (asumming the upload always is succesfull).
I use lower case for the content-type
in the request headers, and also set this above the web url block.
You could use a File.Exists block to test the validity of your file path
On Android below 4.4 (API 19, KitKat
) storage permissions (READ / WRITE
) are required also for the ASD.
Thanks Anke.
I don't know if I need to request permissions on my own, or if some of the blocks I already use, request the permissions for me.
Those images are shown at installation of the app in both older tablets.
.
If I try to do it, setting up the block Screen1 . AskForPermission WriteExternalStorage at Screen1 .Initialize, then Android11 tells me on start that permision is not granted.