[Lazarus] How to show a picture in a CGI app?

silvioprog silvioprog at gmail.com
Sat Apr 2 18:50:57 CEST 2011


Resumed code:

[code]
uses
  Classes, FileUtil, HTTPDefs, fpWeb, fpHTTP;

var
  VFileStream: TFileStream;
begin
  VFileStream := TFileStream.Create(
    UTF8ToSys('C:\lazarus\images\ide_icon48x48.png' { Or your picture.
}), fmOpenRead);
  try
    AResponse.ContentType := 'image/png';
    AResponse.ContentStream := VFileStream;
    AResponse.SendContent;
    Handled := True;
  finally
    VFileStream.Free;
  end;
end;
[/code]

Thx again.

-- 
Silvio Clécio
=============================================
Blog - silvioprog.com.br
Twitter - twitter.com/silvioprog
LazSolutions - code.google.com/p/lazsolutions
Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
=============================================




More information about the Lazarus mailing list