FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Use Ximage also for HTTP images
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Use Ximage also for HTTP images
Posted: Mon Mar 06, 2017 01: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.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Use Ximage also for HTTP images
Posted: Mon Mar 06, 2017 03:13 PM
Specify the URL as the source. That is enough.

Example:
Code (fw): Select all Collapse
@ 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 (fw): Select all Collapse
#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.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion