0

IDHTTPServer: In FireMonkey, how to I serve images from within the app as web images?

For example: works with images stored in the filestructure. I don't want to have to save the images to the file structure before serving them. All help appreciated.

Charles Barouch
  • 313
  • 2
  • 12

1 Answers1

2

You don't need a physical file on the filesystem. In your OnCommand... handler, create an instance of a suitable TStream to hold the image data, like a TMemoryStream, and assign it to the AResponseInfo.ContentStream property. And assign the AResponseInfo.ContentType property to describe the type of data you are sending, like image/png, image/jpeg, etc.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770