FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Display jpg via http url
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Display jpg via http url
Posted: Tue Dec 11, 2012 09:46 PM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display jpg via http url
Posted: Wed Dec 12, 2012 11:37 AM
Robb,

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

Code (fw): Select all Collapse
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Display jpg via http url
Posted: Thu May 04, 2023 05:32 PM

Thank you Antonio!

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Display jpg via http url
Posted: Thu May 04, 2023 05:33 PM

Hi Antonio,

Where do I get urlmon.dll?

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display jpg via http url
Posted: Thu May 04, 2023 05:42 PM

Dear Darrell,

It is a Windows DLL so it is available by default

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Display jpg via http url
Posted: Sat May 06, 2023 03:16 PM
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 (fw): Select all Collapse
cUrl := "https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"
XIMAGE( cUrl )


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.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion