I use the following SQL to store a standard JPG image inside a varbinary(max)
field:
INSERT INTO Logos(cid,logo)
SELECT 12484, BulkColumn FROM OPENROWSET(Bulk 'C:\Logos\12484.jpg', SINGLE_BLOB) AS BLOB
Then I have a script attached to my report that queries that table:
async function beforeRender(req, res) {
await sql.connect(config)
const sqlReq = new sql.Request();
const recordset = await sqlReq.query(
`SELECT * FROM Logos WHERE cid=12484`
)
Object.assign(req.data, { logo: recordset });
const logo=req.data.logo.recordset;
req.data.logo=logo;
console.log(logo);
}```
It seems to grab it fine, but the result looks to be encoded and I'm not sure how to get it displayed as an image.