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 toscan
Blob to scan
STRING filename
The filename of the blob. Wrapping a blob requires a filename. If the filename ends with '.*', it will be replaced with the proper extensopn
RECORD options
Options
BOOLEAN extractdominantcolor
If TRUE, extract the dominant color from images
BOOLEAN generatehash
If TRUE, calculate the hash of the data
STRING mimetype
Force the mimetype to the requested type
Return value
RECORD
The wrapped blob
BLOB data
The blob itself
STRING dominantcolor
Image's dominant color as a #RRGGBB
code, 'transparent' if the image is transparent. Only extracted if the extractdominantcolor option is enabled
STRING extension
The proper or usual extension for the file's mimetype, if known to webhare. Either empty or a text starting with a dot ('.')
STRING filename
Filename of the wrapped blob
STRING hash
UFS encoded SHA-256 hash of the file. Only calculated if the generatehash option is enabled
INTEGER heigh
Image height (in pixels)
STRING mimetype
The mimetype for the file. If unrecognized, application/octet-stream
BOOLEAN mirrored
True if this is a mirrored image
RECORD refpoint
Reference point if set, default record otherwise
INTEGER refpoint.x
X coordinate of reference point (in pixels)
INTEGER refpoint.y
Y coordinate of reference point (in pixels)
INTEGER rotation
Image rotation in degrees (0,90,180 or 270)
INTEGER width
Image 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)