From Web to image control

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

From Web to image control

Post by quartz565 »

Hello my friends !
How download a image from a website and put it automatically into a image control ?
The name of the image I find is what I need.

Niko
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: From Web to image control

Post by serge_girard »

Niko, Can you please explain more details/example about what you want?

Serge
There's nothing you can do that can't be done...
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: From Web to image control

Post by gfilatov »

quartz565 wrote: Fri Oct 27, 2017 3:21 pm Hello my friends !
How download a image from a website and put it automatically into a image control ?
The name of the image I find is what I need.
Hello Niko,

It is possible with HMG Extended in the following easy way
Win_1.Image_1.Picture := cUrl
Please take a look for a working sample below:

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 * (c) 2017 Grigory Filatov <gfilatov@inbox.ru>
*/

#include <hmg.ch>

FUNCTION Main
   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"

   define window win_1 ;
      main ;
      clientarea 800, 633 ;
      title "JPEG Image From URL" ;
      backcolor { 204, 220, 240 } nosize

      on key escape action win_1.release()

      DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 100,16 FLAT

	BUTTON Button_1 ;
		CAPTION 'EiffelTower' ;
		ACTION ( Win_1.Image_1.Picture := cUrl2 ) ;
		TOOLTIP 'Load Eiffel Tower background'

	BUTTON Button_2 ;
		CAPTION 'TajMahal' ;
		ACTION ( Win_1.Image_1.Picture := cUrl1 ) ;
		TOOLTIP 'Load Taj Mahal background'

      END TOOLBAR

      define image image_1
         row 33
         col 0
         width 800
         height 600
         picture cURL2
         stretch .T.
      end image

   end window

   win_1.minbutton := .F.
   win_1.maxbutton := .F.

   win_1.center
   win_1.activate

RETURN NIL
Hope that useful :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: From Web to image control

Post by quartz565 »

Thanks Serge, Grigory

My English is very poor... but I will try to explain better what I would like:

1. In my program I create a url where the image name is the variable part of this url.
2. Through hyperlink control I do search on the web
3. When I choose between the many images, that interest me and which I will
        appears in my image control (as Grigorys example (thank you !)).
4. I'm going through my program by tapping save image as: to save it
      in a folder on the disc with a new image name.

is this possible?

Niko
Best Regards,
Nikos.

os: Windows Server 2019 - 64
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: From Web to image control

Post by KDJ »

Niko

How to download a file, see here: http://www.hmgforum.com/viewtopic.php?t=5321
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: From Web to image control

Post by KDJ »

This is an example in HMG:

ImageFromWeb.png
ImageFromWeb.png (185.43 KiB) Viewed 4887 times
ImageFromWeb.zip
(1.99 KiB) Downloaded 251 times
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: From Web to image control

Post by serge_girard »

Great ! Thanks a lot, it could be very usefull !

Serge
There's nothing you can do that can't be done...
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: From Web to image control

Post by quartz565 »

KDJ wrote: Sat Oct 28, 2017 8:50 pm This is an example in HMG:


ImageFromWeb.png


ImageFromWeb.zip
Thanks a lot my friend! I'll try it right away!
Niko
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: From Web to image control

Post by Rathinagiri »

Wonderful KDJ!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: From Web to image control

Post by quartz565 »

Wonderful !!!
Thanks Krzysztof!
Best Regards,
Nikos.

os: Windows Server 2019 - 64
Post Reply