I do not want multithreading. I assume that each connection is a thread, no? The images are broken, partially displayed, the image is displayed as text characters.
Maybe this will help, here is my code so far: procedure TForm1.HttpServer1GetDocument(Sender, Client: TObject; var Flags: THttpGetFlag); var C: THttpConnection; begin C := THttpConnection(Client); if C.Path = '/' then begin ShowDirectory(Sender, Client, Flags); Exit; end; if FileExists(C.Document) and (Pos('image', C.Params)>0) then begin ShowShowimage(Sender, Client, Flags); Exit; end; end; procedure TForm1.ShowThumb(Sender, Client: TObject; Flags: THttpGetFlag); var i: Integer; C: THttpConnection; JPeg: TJPegImage; ar: Double; nx, ny: Integer; ms: TMemoryStream; begin C := THttpConnection(Client); Flags := hgSendStream; ms := TMemoryStream.Create; JPeg := TJPegImage.Create; JPeg.LoadFromFile(C.Document); if Jpeg.Width > 100 then begin ar := 100 / JPeg.Width; nx := Round(JPeg.Width * ar); ny := Round(JPeg.Height * ar); ResizeJPeg(JPeg, nx, ny); end; JPeg.SaveToStream(ms); JPeg.Free; C.DocStream := ms; C.AnswerStream(Flags, '', 'image/jpeg', ''); end; ----- Original Message ----- From: "Francois Piette" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Tuesday, August 16, 2005 9:43 AM Subject: Re: [twsocket] Httpserver and threads > First make this work single threaded, starting with ICS sample program > WebServ. > Your image URL must match a dynamic URL intercepted by the server so that > processing can be done. > > Multithreading is probably not needed and can be added later when > eveything else works OK. > > -- > [EMAIL PROTECTED] > http://www.overbyte.be > > ----- Original Message ----- > From: "Tom York" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Tuesday, August 16, 2005 4:36 PM > Subject: [twsocket] Httpserver and threads > > >> I am making a small server to display a page of images. In the >> getdocument >> method, I call a procedure passing all of the flags to my procedure >> "ShowThumb(Sender, Client, Flags)". What is happening is that the images >> are being displayed on the page, but they are coming out as garbage >> characters, randomly truncated images, etc. >> >> The images stored on disk are good. I believe I am running into some >> kind >> of threading issue. I read the images off disk, scale them, save the to >> a >> stream and pass them to HttpConnection.DocStream to complete the page. >> >> Any assistance is greatly appreciated. Thanks >> >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://www.elists.org/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://www.elists.org/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be > > > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.338 / Virus Database: 267.10.10/73 - Release Date: 8/15/2005 > > -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be