WrapBlob (open)
Create a record wrapping the blob and its contents
Syntax
LOADLIB "wh::files.whlib";
RECORD FUNCTION WrapBlob(BLOB toscan, STRING filename, RECORD options)Parameters
BLOB toscanBlob to scan
STRING filenameThe filename of the blob. Wrapping a blob requires a filename. If the filename ends with '.*', it will be replaced with the proper extensopn
RECORD optionsOptions
BOOLEAN extractdominantcolorIf TRUE, extract the dominant color from images
BOOLEAN generatehashIf TRUE, calculate the hash of the data
STRING mimetypeForce the mimetype to the requested type
Return value
RECORDThe wrapped blob
BLOB dataThe blob itself
STRING dominantcolorImage's dominant color as a #RRGGBB code, 'transparent' if the image is transparent. Only extracted if the extractdominantcolor option is enabled
STRING extensionThe proper or usual extension for the file's mimetype, if known to webhare. Either empty or a text starting with a dot ('.')
STRING filenameFilename of the wrapped blob
STRING hashUFS encoded SHA-256 hash of the file. Only calculated if the generatehash option is enabled
INTEGER heighImage height (in pixels)
STRING mimetypeThe mimetype for the file. If unrecognized, application/octet-stream
BOOLEAN mirroredTrue if this is a mirrored image
RECORD refpointReference point if set, default record otherwise
INTEGER refpoint.xX coordinate of reference point (in pixels)
INTEGER refpoint.yY coordinate of reference point (in pixels)
INTEGER rotationImage rotation in degrees (0,90,180 or 270)
INTEGER widthImage width (in pixels)
Description
This function returns the same record as ScanBlob, but adds a 'data', 'filename' and 'extensions' members required for storage in some databases (eg, WHFS, WRD)