Images must be taken by the scanner and feature:
- The front of the item with the Serial number being visible
- Enough Light. Users should be able to see the image on the screen and be able to re-take a photo before uploading (e.g. pressing scan button)
- The image should be resized by the scanner to 1024px to 768px (or just 1024px width) or higher and submitted in jpeg format.
- The Image should be serialized (Base64) and passed as a parameter to the GramChainInsertViaScanner API SerializedImage parameter which will hash the Base64 and store the image as a jpeg file named after it’s hash .
- Once inserted Images can be retrieved as follows: ImageServer/Images/ImageHash.jpeg where:
- ImageServer/ is the server address, e.g. https://GramChain-test.littlebit.sg/
- Images/ is hardcoded string / folder
- ImageHash is the image hash and can be found in API GetSingleLogFullDetails
- .jpeg is the hardcoded string
Note that ImageServer will change once the system goes into production and it might be a different address from the API server as we might outsource image storage to a commercial service. Best practice is to use the prebuild ImageURL parameter from GetSingleLogFullDetails to abstract migration issues away.
Uploaded images will have a QR code added top right which links back to the GramChain explorer for a given parcel. This allows users to easily check a parcel status from a image. On the bottom right, we are adding a little GramChain watermark to reduce the likelihood of third parties copying the images.
The SerializedImage variable will be hashed using SHA256 and the resulting hash will be used as the FileName for the image. The Hash is computed as follows:
HashAlgorithm algorithm = SHA256.Create();
Resulting in sample hash file as follows:
The file will be saved as (where ~ is the server name, e.g. “https://GramChain.net/”)
Utilitze ImageURL to get the image URL to load / display the image.