Display jpg via http url

Display jpg via http url

Postby rhlawek » Tue Dec 11, 2012 9: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
User avatar
rhlawek
 
Posts: 193
Joined: Sun Jul 22, 2012 7:01 pm

Re: Display jpg via http url

Postby Antonio Linares » Wed Dec 12, 2012 11:37 am

Robb,

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

Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Display jpg via http url

Postby cdmmaui » Thu May 04, 2023 5:32 pm

Thank you Antonio!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Display jpg via http url

Postby cdmmaui » Thu May 04, 2023 5:33 pm

Hi Antonio,

Where do I get urlmon.dll?
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Display jpg via http url

Postby Antonio Linares » Thu May 04, 2023 5:42 pm

Dear Darrell,

It is a Windows DLL so it is available by default
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Display jpg via http url

Postby nageswaragunupudi » Sat May 06, 2023 3: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: Select all  Expand view
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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 95 guests