Use Ximage also for HTTP images

Use Ximage also for HTTP images

Postby Marc Venken » Mon Mar 06, 2017 1:42 pm

Hello,

I use this

@ 40,500 XIMAGE oImage SIZE 250, 250 OF oWnd SOURCE "r:\pictures\"+alltrim(nofoto->orgfoto)

and a Xbrowse To show pictures located on my drive. There is a field in a dbf that has a reference to the file on drive.

Now I want to put a link like this in the dbf : without the "" "" because else the forum give a link "https"://cdn.sportdirect.com/resizer/500x500/108104-8200-01.jpg

So if the filename starts with "http" there is a file on the internet, otherwise the file on drive is needed.

How to addapt the above syntax for the XIMAGE ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1397
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Use Ximage also for HTTP images

Postby nageswaragunupudi » Mon Mar 06, 2017 3:13 pm

Specify the URL as the source. That is enough.

Example:
Code: Select all  Expand view

@ 40,500 XIMAGE oImage SIZE 250, 250 OF oWnd ;
SOURCE "https://upload.wikimedia.org/wikipedia/commons/c/c8/Taj_Mahal_in_March_2004.jpg"
 


Please try this sample:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oImage, oBar
   local cURL1  := "https://upload.wikimedia.org/wikipedia/commons/c/c8/Taj_Mahal_in_March_2004.jpg"
   local cURL2  := "http://cdn.history.com/sites/2/2015/04/hith-eiffel-tower-iStock_000016468972Large.jpg"
   local cURL   := cURL1

   DEFINE WINDOW oWnd TITLE "FWH : XIMAGE"
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
   DEFINE BUTTON OF oBar PROMPT "EiffelTower" CENTER ACTION ( cUrl := cUrl2, oImage:Refresh() )
   DEFINE BUTTON OF oBar PROMPT "TajMahal"    CENTER ACTION ( cUrl := cUrl1, oImage:Refresh() )

   @ 0,0 XIMAGE oImage OF oWnd SOURCE cURL

   oWnd:oClient := oImage

   oWnd:nWidth    := 800
   oWnd:nHeight   := 600

   ACTIVATE WINDOW oWnd CENTERED

return nil
 


This sample also shows how to switch images just by changing the value of the variable. Click on the buttons "EiffelTower" or "Tajmahal" to switch the images.

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10471
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 83 guests