Einzelnen Beitrag anzeigen

schwa226

Registriert seit: 4. Apr 2008
400 Beiträge
 
#1

Overbyte ICS und AnswerStream

  Alt 5. Feb 2011, 22:55
Hi,

ich bin gerade dabie mich in den Web Server von Overbyte einzuarbeiten.

Über diese Funktion kann ich schon einmal ein Jpeg im Browser anzeigen:
Delphi-Quellcode:
procedure TUrlHandlerTest.Execute;
var
  JpegImg : TJPEGImage;
  BitMapImg : TBitmap;
begin

  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('test1')) div 2 - 1,
  (BitMapImg.Height - BitMapImg.Canvas.TextHeight('test1')) div 2 - 1,
            'test1');
         JpegImg.Assign(BitMapImg);
         JpegImg.SaveToStream(DocStream);
     finally
         BitMapImg.Destroy;
     end;
  finally
     JpegImg.Destroy;
  end;
  AnswerStream('', 'image/jpeg', NO_CACHE);

  Finish;
end;
Aber nun ist halt nur das Bild selber sichtbar.

Ich habe aber eine HTML Seite worin ich ein Bild anzeigen will. Geht das auch?
Oder muss ich das Jpeg zuerst auf der Festplatte speichern und dann ein Image Link im HTML einbauen?
Delphi 2010, Update 4 & 5
  Mit Zitat antworten Zitat