?
Solved

How can I show an image in a desktop using  a html tag ?

Posted on 2003-03-27
5
Medium Priority
?
230 Views
Last Modified: 2010-04-04
Hi,

I have a html tag like this:

<img src="http://hostname/image.bmp" border="0">

How can i show this image in a desktop application?

Thanks.

0
Comment
Question by:faustomen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 2

Expert Comment

by:j42
ID: 8217528
Hi,
ever tried this?

  WebBrobser1.Navigate('http://hostname/image.bmp');



Regards
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8218925
you can also use Indy's TIdHTTP component:

implementation

uses IdHTTP;

procedure GetURLFile(const FromURL, ToFileName: string);
var
  http: TIdHTTP;
  fs: TFileStream;
begin
  http := TIdHttp.Create(nil);
  fs := TFileStream.Create(ToFileName, fmCreate);
  try
    http.Get(FromURL, fs);
  finally
    fs.Free;
    http.Free;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  GetURLFile('http://www.experts-exchange.com/v3.0/images/greyLogo.jpg', 'D:\saved.jpg');
end;

wbr, mo.
0
 
LVL 9

Accepted Solution

by:
mocarts earned 800 total points
ID: 8220682
sorry, didn't provide you with code which loads image into TImage component... :)

uses IdHttp, Jpeg;

procedure TForm1.Button1Click(Sender: TObject);
var
 fs: TMemoryStream;
 jp: TGraphic;
begin
 http := TIdHttp.Create(nil);
 fs := TMemoryStream.Create;
 try
   // downloading image into the stream
   http.Get('http://www.experts-exchange.com/v3.0/images/greyLogo.jpg', fs);
   // to load bitmap change the line below to
   // jp := TBitmap.Create;
   jp := TJpegImage.Create;
   try
     // must set to the beginning of stream
     fs.Position := 0;
     // to avoid subsequent assignments first set graphic to desired graphic
     Image1.Picture.Graphic := jp;
     // loading into the image control
     Image1.Picture.Graphic.LoadFromStream(fs);
   finally
     jp.Free;
   end;
 finally
   fs.Free;
   http.Free;
 end;
end;

note: you can download latest Indy components from http://www.indyproject.org/

wbr, mo.
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8220762
you can easily check image type and create apropriate object instance by checking Response's ContentType property:
...
http.Get('http://www.experts-exchange.com/v3.0/images/greyLogo.jpg', fs);
if http.Response.ContentType = 'image/jpeg' then
  jp := TJpegImage.Create
else if http.response.ContentType = 'image/bmp' then
  jp := TBitmap.Create;
...

wbr, mo.
0
 

Author Comment

by:faustomen
ID: 8227341
Ok mocarts.

Thanks again.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question