Board index » delphi » Sending a generated JPEG as a response
Graham Harris
![]() Delphi Developer |
Sending a generated JPEG as a response2007-05-03 07:09:25 PM delphi276 Hi I have a ISAPI DLL that interfaces with a service that generates a JPEG image. I can, in a regular Win32 Application, retreive the image, and this seems to be happening in the ISAPI program. Once I get the image this is the code that I am using the following method to send the data: procedure TwmMain.SendResponse(Response: TWebResponse; Image: TStream; FileName, ContentType: AnsiString); begin Response.ContentType := ContentType; Response.SetCustomHeader('Content-disposition', 'attachment;filename=Map.jpg'); Response.SetCustomHeader('Accept-Ranges', 'bytes'); Response.SetCustomHeader('Content-Length', IntToStr(Image.Size)); Image.Seek(0, soFromBeginning); Response.ContentStream := Image; Response.SendResponse; end; In Opera I get prompted to save the file which then when I save the file the file is not being streamed. In IE 7 the file is streamed and is OK, again I am prompted if I want to save the image or not. The idea is that I pass the URL to generate the image in the following manner: <img src="http://localhost/WebTrack.dll/Tracking?Docket=1890&Height=800&Width=600" />. I am using Delphi 2006 on Windows XP (Fully updated) TIA Graham Harris |