🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
5 messages
5 total messages Started by chris Tue, 19 Dec 2006 16:27
http image requests?
#384
Author: chris
Date: Tue, 19 Dec 2006 16:27
15 lines
1373 bytes
I would like to be able to take a jpeg from a server to an 
image box in C++ builder 6.0. Lets say, at address 
"http://192.168.1.10/folder/image.jpg". Is there any way 
possible that I can pull the file straight from that address 
into my application? I have also tried using 
the "CppWebBrowser" ActiveX to open the page, and while it is 
open, I try to pull the file from the Temp Internet Files. 
However the file is still a link in this folder and is not 
recognized as a jpeg. I can't even use the "CopyFile()" 
Function with it. 

Any help is much appreciated!

chris
Re: http image requests?
#385
Author: Hans Galema
Date: Tue, 19 Dec 2006 17:42
13 lines
1380 bytes
chris wrote:
> I would like to be able to take a jpeg from a server to an 
> image box in C++ builder 6.0. Lets say, at address 
> "http://192.168.1.10/folder/image.jpg". Is there any way 
> possible that I can pull the file straight from that address 
> into my application?

Yes you can.

Use TIdHttp to Get it from that url in a stream.
Then use Image1->Picture->LoadFromStream();

Hans.
Re: http image requests?
#436
Author: Remy Lebeau (TeamB)
Date: Tue, 19 Dec 2006 18:40
27 lines
1847 bytes
"chris" <help@help.com> wrote in message
news:458812d8$1@newsgroups.borland.com...

> I would like to be able to take a jpeg from a server to
> an image box in C++ builder 6.0.

You will have to download the image to a TStream or a file first, and then
load that afterwards.

> Is there any way possible that I can pull the file straight from that
> address into my application?

There are many ways to do that.  Use a third-party HTTP component, such as
the one from Indy (http://www.indyproject.org), ICS
(http://www.overbyte.be), or Synapse (http://www.ararat.cz/synapse).  Or use
Microsoft's WinInet or WinHTTP libraries, such as the URLDownloadToFile
(http://msdn.microsoft.com/workshop/networking/moniker/reference/functions/u
rldownloadtofile.asp) or URLDownloadToCacheFile()
(http://msdn2.microsoft.com/en-gb/library/ms775122.aspx) function.

> I have also tried using the "CppWebBrowser" ActiveX to open the page

Do not go that way.  That is a lot of unnecessary overhead.


Gambit
Re: http image requests?
#437
Author: Remy Lebeau (TeamB)
Date: Tue, 19 Dec 2006 18:41
14 lines
1345 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:458824ea@newsgroups.borland.com...

> Use TIdHttp to Get it from that url in a stream.
> Then use Image1->Picture->LoadFromStream();

TPicture::LoadFromStream() only works for bitmaps.  To load a JPG, you will
have to use TPicture::LoadFromFile() instead (making sure the JPG format is
registered with TPicture first), or else instantiate a separate TJPEGImage
and then call its LoadFromStream() instead.


Gambit
Re: http image requests?
#438
Author: chris
Date: Tue, 19 Dec 2006 20:09
7 lines
1052 bytes
Thanks for the info. That should do what I need it to. Now I 
just have to apply it.

Thanks again,

chris
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads