What you do cannot work. You store the image in binary format and then try to retrieve it as string.
Either encode it in the DB as base64 string and use it as-is client-side or retrieve the DB field data as binary data and convert it client side to base64 string.
But can i add to my entity class a new "calculated" field with Image_Base64 with get_ and set_ values and use it to webapp ? if yes can give me code sample ?
If DataSet.FieldByName('Immagine').AsString <> '' Then Begin
WebImageControl1.URL:='data:image/jpeg;base64,'+DataSet.FieldByName('Immagine').AsString;
Bitmap.LoadFromResource('data:image/jpeg;base64,'+DataSet.FieldByName('Immagine').AsString);
End;
In the image see the red "X" painted in the WebImageControl1.URL BUT Bitmap.LoadFromResource( give me error. if you see Form is wrong with the error next !!!
I've created a sample, with a simple JPEG base 64 string. It loads here without errors.Sample.zip (7.8 KB)
Please provide a sample, or base64 string that produces the error so we can see what exactly is going wrong. Additionally, are you using the latest version?
I discovered the problem : is the "while not eof " iteration BUT i dont known how to solve it, with separated thread ? see the code below
DataSet.First();
While Not DataSet.Eof Do Begin
With Items.Add Do Begin
Bitmap.Height:=50; Bitmap.Width:=50;
// HERE THE PROBLEM
If DataSet.FieldByName('Immagine').AsString <> '' Then
Bitmap.LoadFromResource('data:image/jpeg;base64,'+DataSet.FieldByName('Immagine').AsString);
End;
End;
// RECORD CHANGE BEFORE IMAGE IS ENTIRELY LOADED
DataSet.Next();
End;
It's unclear exactly what you want to achieve. Attached is a sample that demonstrates how to add icons inside the TTMSFNCTableView. When calling Bitmap.LoadFromResource, the image is loaded asynchronously. What is the issue exactly that you are experiencing? Please explain more in detail with step by step instructions.
Your project is static better you LoadFromResource(IMG1) where IMG is a const. To me the problem is dynamic : I load an image by dataset field when it iterate