I have a MySQL database that saves customer signatures as base64 BLOB field. Is there a way to show that data as an image on the report using TDBImage?
You can use the TDBImage.OnGetPicture event to get the image data before it is assigned to the Picture property. Inside this event, you would need to retrieve the encoded image data, decode it, and assign it to the aPicture parameter.
ReportBuilder does not have the ability to decode base64 data automatically. When needed, we use the NetEncoding routines to do so:
It appears you are trying to accomplish this in RAP. RAP does not support the complete Delphi object library so pass-thru function(s) will need to be used to decode the image data. See the main RAP demo for how to implement RAP Pass-thru functions.
My suggestion is to get this working in Delphi first to be sure the streaming and decoding is functioning correctly. Then move your code to RAP including pass-thru functions for the unsupported aspects (TNetEncoding, TMemoryStream, etc.).
Comments
You can use the TDBImage.OnGetPicture event to get the image data before it is assigned to the Picture property. Inside this event, you would need to retrieve the encoded image data, decode it, and assign it to the aPicture parameter.
ReportBuilder does not have the ability to decode base64 data automatically. When needed, we use the NetEncoding routines to do so:
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I tried with a TStream, but also have a problem RB not knowing TMemoryStream. How do I add uses System.NetEncoding, to the RP template?
It appears you are trying to accomplish this in RAP. RAP does not support the complete Delphi object library so pass-thru function(s) will need to be used to decode the image data. See the main RAP demo for how to implement RAP Pass-thru functions.
My suggestion is to get this working in Delphi first to be sure the streaming and decoding is functioning correctly. Then move your code to RAP including pass-thru functions for the unsupported aspects (TNetEncoding, TMemoryStream, etc.).
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com