Are there any plans to include direct Binary Image display from an SQL Server Image (BLOB) data-type?
I understand I can use a download/file reference method, but I was wondering if direct-display of the Image Data type is planned or possible to add in the future.
Thanks
Mike
Hello,
I think this can be done using html code, where ‘uploadField’ is the database column name of grid.
$col["default"] = '<img src="data:image/jpeg;base64,'.base64_encode({uploadField}) .'" />';
I did try that method, but that is for MySQL.
I should have been more specific, I’m using Microsoft SQL Server.
As soon as I bring-in a BINARY field that’s an image-type (JPG, BMP) to a report I get a pop-up “ERROR” on the grid and no data returned. I suspect the issue has to to do with the way SQL Server stores the binary image data compared to MySQL. So I don’t think the data is being returned to the report-engine to process.
The $g->debug doesn’t show anything obvious and there’s nothing obvious in the Console/Debug in Chrome.
The same binary field can contain text and as long as there is text in the field and not an image, it displays fine. The DB Schema has a TYPE so I know whether the field is text or a photo/graphic.
I have a work-around with a helper page that returns a URL with the right header settings – but it would ideally be more convenient if I could process it directly on the report.
Thanks
Mike
Mysql also uses binary data to save in database. The base64_encode function is used for the same reason.
As in https://www.php.net/manual/en/function.base64-encode.php – This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
If it does not solve, You can share your full grid code for review.