Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Bild aus Resource mit IdHTTPServer ohne Temporärdatei? (https://www.delphipraxis.net/15453-bild-aus-resource-mit-idhttpserver-ohne-temporaerdatei.html)

FriFra 28. Jan 2004 23:37


Bild aus Resource mit IdHTTPServer ohne Temporärdatei?
 
Wie bekomme ich ein Bild aus einer Resource ohne eine Temporärdatei zum Client?

Bisher mache ich es so:
Delphi-Quellcode:
        AResponseInfo.ContentType := 'image/jpeg';
        try
          RS := TResourceStream.Create(0, 'background', RT_RCDATA);
          RS.Position := 0;
          TmpFile := GetTempFile;
          RS.SaveToFile(TmpFile);
          IdHTTPServer1.ServeFile(AThread, AResponseInfo, TmpFile);
          try
            DeleteFile(TmpFile);
          except
          end;
        finally
          RS.Free;
        end;
Allerdings passiert es dabei schonmal, dass der Server zu langsam ist und die Datei schon gelöscht ist ist bevor sie gestreamt wurde.


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:41 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz