Page 1 of 1

Display jpg via http url

Posted: Tue Dec 11, 2012 9:46 pm
by rhlawek
Is there an example that can show me how to display a jpg file from an http link in a popup window or dialog? Nothing fancy, just a simple window to display a 320x240 jpg to the user, with the ability to close the window after review.

I'm using coverflow for some of this now but I first have to copy the jpg files locally then reference the local file. Antonio, I am using the example you shared with me to do this from a file. If coverflow, or any other control, can also display the file directly from the url that would most likely fill my needs.

It seems that this should be easy, not sure why I'm finding it difficult.

Robb

Re: Display jpg via http url

Posted: Wed Dec 12, 2012 11:37 am
by Antonio Linares
Robb,

Please try this code to download an image from a remote URL:

Code: Select all | Expand

function URLDownLoad(cUrl, cSaveAs)
local hLib := LOADLIBRARY( "urlmon.dll")
if ! URLDownloadToFile( 0, cUrl, cSaveAs, 0, 0 ) == 0
   return .F.
endif
FreeLibrary( hLib )
return .T.

DLL32 FUNCTION URLDownloadToFile(pCaller AS LONG,szURL AS STRING, szFileName AS STRING, dwReserved AS LONG, lpfnCB AS LONG);
AS LONG PASCAL;
FROM "URLDownloadToFileA";
LIB hlib

Re: Display jpg via http url

Posted: Thu May 04, 2023 5:32 pm
by cdmmaui
Thank you Antonio!

Re: Display jpg via http url

Posted: Thu May 04, 2023 5:33 pm
by cdmmaui
Hi Antonio,

Where do I get urlmon.dll?

Re: Display jpg via http url

Posted: Thu May 04, 2023 5:42 pm
by Antonio Linares
Dear Darrell,

It is a Windows DLL so it is available by default

Re: Display jpg via http url

Posted: Sat May 06, 2023 3:16 pm
by nageswaragunupudi
Is there an example that can show me how to display a jpg file from an http link in a popup window or dialog? Nothing fancy, just a simple window to display a 320x240 jpg to the user, with the ability to close the window after review.
Very Simple:

Code: Select all | Expand

cUrl := "https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"
XIMAGE( cUrl )
Image

First run this two line program and then you will know how to use it with other URLs.
No need to copy locally.
All FWH image functions directly fetch the image from the URL and display.