Page 1 of 4
From Web to image control
Posted: Fri Oct 27, 2017 3:21 pm
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
Re: From Web to image control
Posted: Fri Oct 27, 2017 6:49 pm
by serge_girard
Niko, Can you please explain more details/example about what you want?
Serge
Re: From Web to image control
Posted: Fri Oct 27, 2017 7:02 pm
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
Re: From Web to image control
Posted: Sat Oct 28, 2017 11:19 am
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
Re: From Web to image control
Posted: Sat Oct 28, 2017 12:54 pm
by KDJ
Re: From Web to image control
Posted: Sat Oct 28, 2017 8:50 pm
by KDJ
This is an example in HMG:
- ImageFromWeb.png (185.43 KiB) Viewed 4929 times
Re: From Web to image control
Posted: Sun Oct 29, 2017 7:36 am
by serge_girard
Great ! Thanks a lot, it could be very usefull !
Serge
Re: From Web to image control
Posted: Sun Oct 29, 2017 11:38 am
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
Re: From Web to image control
Posted: Sun Oct 29, 2017 2:27 pm
by Rathinagiri
Wonderful KDJ!
Re: From Web to image control
Posted: Sun Oct 29, 2017 7:44 pm
by quartz565
Wonderful !!!
Thanks Krzysztof!