PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Downloading a .jpg to a directory without using a imageControl
Downloading a .jpg to a directory without using a imageControl
Débuté par Stephan Wiestner, 06 oct. 2022 13:23 - 2 réponses
Membre enregistré
10 messages
Posté le 06 octobre 2022 - 13:23
Hello
Sorry guys, I'm running in circles.
All i want is

downloading in WD "
]https://image.tmdb.org/t/p/original//85zUipgVy2QbvAJ6djZXYaGckMv.jpg

to c:\images\mypicture.jpg

If i assign it to an imagecontrol on a window and later save the control it works,

but i'm looking for a direct way.

I tried with a variable type image: doesn't work
with dsavejpg: doesn't work
with dloadimage: doesn't work
and even fcopy doesn't work

Any help, pls?
Thx so much for it
Posté le 06 octobre 2022 - 13:42
Hi Stephan,

This should work :

lsURL is string = "https://image.tmdb.org/t/p/original//85zUipgVy2QbvAJ6djZXYaGckMv.jpg"
LBuffer is Buffer
LsDestinationFile is string = "c:\images\mypicture.jpg"

IF NOT httpRequest(lsURL) THEN
Error(ErrorInfo)
RETURN
END
LBuffer = HTTPGetResult(httpResult)
IF NOT fMakeDir(fExtractPath(LsDestinationFile,fDirectory+fDrive)) THEN
Error(ErrorInfo)
RETURN
END
IF NOT fSaveBuffer(LsDestinationFile,LBuffer) _OR_ NOT fFileExist(LsDestinationFile) THEN
Error("Impossible to save file '"+lsURL+"' as '"+LsDestinationFile+"'.",ErrorInfo)
RETURN
END
Info("download done.")


Kind regards
Joris
Membre enregistré
10 messages
Posté le 06 octobre 2022 - 18:46
Thx Joris! You are a genious! Works like a charm Thx again!