I am trying to send a jpg from delphi's tjpgImage to a client with the
tHTTPServer component.
Would like to keep it in a memory stream and not save to disk, but
AnswerStream is not what it sounds like.
Searched the archives but found little that was close to what I wanted.
Still using ICS 5.
Any ideas?
Extracted from one of my programs in a TUrlHandler:
DocStream := TMemoryStream.Create;
JpegImg := TJPEGImage.Create;
try
BitMapImg := TBitMap.Create;
try
BitMapImg.Width := 64;
BitMapImg.Height := 32;
BitMapImg.Canvas.Pen.Color := clBlack;
BitMapImg.Canvas.Brush.Color := clGray;
BitMapImg.Canvas.RoundRect(0, 0,
BitMapImg.Width - 1, BitMapImg.Height - 1, 16, 16);
BitMapImg.Canvas.Font.Name := 'arial';
BitMapImg.Canvas.Font.Size := 14;
BitMapImg.Canvas.Font.Color := clWhite;
BitMapImg.Canvas.TextOut(
(BitMapImg.Width - BitMapImg.Canvas.TextWidth(CounterString)) div 2 - 1,
(BitMapImg.Height - BitMapImg.Canvas.TextHeight(CounterString)) div 2 - 1,
CounterString);
JpegImg.Assign(BitMapImg);
JpegImg.SaveToStream(DocStream);
finally
BitMapImg.Destroy;
end;
finally
JpegImg.Destroy;
end;
AnswerStream('', 'image/jpeg', NO_CACHE);
Does it helps ?
--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be