Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In our What is a resource? article, we noted that a resource is digital content which can be represented by various media types. Most of the time this will be text based media (e.g., HTML, JSON, XML). However, perhaps you need to return binary media, such asthere will be situations when the resource needs to be represented by binary media. Here are a few possible use cases:

  • A PDF version of a customer invoice.
  • A JPEG image of a barcode.
  • An MPEG video of assembly instructions.

...

The SRP HTTP Framework includes a routine called Picture_API, which includes logic that returns the graphic images associated with a specified contact. This article will break it down into the two basic steps.

Step One: Load the binary data into a variable.

Typically this will be done using the OSRead statement. Here is the relevant code from the Picture API:

Code Block
languagebp
OSRead PictureBinary from PicturePath then
    // Other logic goes here.
end