PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WM17] - How to save Images returned by a web service in phone storage?
[WM17] - How to save Images returned by a web service in phone storage?
Iniciado por guest, 30,jun. 2015 09:56 - 2 respuestas
Publicado el 30,junio 2015 - 09:56
In an app that I am developing.

I am using following code to retrieve data from web service.
HTTPRequest("http://xxxx.xxx/" + gsID) sResult is Buffer = HTTPGetResult(httpResult) This will return a JSON string which will contain a list of JPG files.

Now my software will have to download each JPG file and save them on the storage media of phone and then show the same as slide show to user.

I tried to save the file with this code:
FileNum = fOpen(fn,foCreate) fWrite(FileNum,sFileData) fClose(FileNum) But the data save is corrupted and does not open up on any image viewer.

What wrong am I doing here?

TIA

Yogi Yang
Publicado el 30,junio 2015 - 11:16
Hi

1. We don't know how you got the data in the first place, so there may be a problem there

2. you are using what seems to be a string (sfiledata) to contain the image data (BINARY!). Use a buffer instead

3. Don't bother with fopen and such. A simple fSaveBuffer will do

Best regards
Publicado el 01,julio 2015 - 07:52
Fabric,

Thanks for the hints.

I will try them.

TIA

Yogi Yang