Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: problem loading pictures of web page using TidHTTPServer and TPageProducer

www.cryer.info
Managed Newsgroup Archive

Re: problem loading pictures of web page using TidHTTPServer and TPageProducer

Subject:Re: problem loading pictures of web page using TidHTTPServer and TPageProducer
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 27 Jun 2006 18:39:09

"Glen Welch" <glen@custommadesoftware.co.nz> wrote in message
news:44a1d68f@newsgroups.borland.com...

> Following is some code I am using to fill in Tags from a web page -
> then send it using TidHTTPServer. Im not sure if this is the best way
> of doing this but I cant get it to work at all. If there is a better way
of
> filling in tags then please let me know cause as you can see I am
> having to save out to the tempary file.

The TIdHTTPResponseInfo parameter of the TIdHTTPServer.OnCommandGet event
handler has ContentStream and ContentText properties.  You can use those
instead of a file, ie:

    procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHttpResponseInfo);
    begin
        //...
        if FileExists(LocalDoc) then
        begin
            htmlPageProducer.HTMLFile := LocalDoc;
            AResponseInfo.ContentText := htmlPageProducer.Content;
            AResponseInfo.ContentType := 'text/html';
        end;
        //...
    end;

> Problem is that images are not being displayed.

That would happen if either 1) the <img> tags are malformed to begin with,
or else 2) your TIdHTTPServer code is not handling the image requests
properly.  Please show a more complete code snippet of what you are actually
doing.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive