i have this iage that i save it into a data base as string using delphi
that's how i save this image to string
that how i retrieve the string back to the actual image
i know this is encoded to base64 but i am not sure how to read it in b4a correctly in image view
B4X:
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//2wBDAQ4ODhMREyYVFSZPNS01T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0//wgARCACmAKYDASIAAhEBAxEB/8QAGgAAAgMBAQAAAAAAAAAAAAAAAAIBBAUDBv/EABgBAQEBAQEAAAAAAAAAAAAAAAABAgME/9oADAMBAAIQAxAAAAHXVlgJBQBYdR3RxgCUbkrSCSLyOxABAsrLIL2g5R2VecMqMyyPBA1axWm36rFzRv5OzZEMsQSKvTnKMrscnhSIIGmHJhlEoNmVorRsmlZklhXgQYEmJQaIICRACXVivPJVjz+/5uyxZ4XF9CKQ6xxjscwhubkyrVAMnKeig6ca5YG/RKdGxXl69qlo9J3x9KuiMkMBLASkurVEgHPopyzNnLs4VoISe9tujZt8MWjZjlqadmhpXMASq/NkdlaoIlAmsVMyOVqcvRZZVGtRz4vaKXUYnd85pVrEGaMr2TMiLJBObfzFoVLs6np/Leow83Nv5sy7lTO5pGvmegrAs59vU9EQY10aZuVloWF6IiYmrm1n7nnPZHXMt18a8l22MEs152dTlvw0eTtR01NU5Gdd0ed4RpgUkOfnfS4hX0c4l3nybvLu2bp9988m1eN80O0S5ehW747QdTfGQLkUFlQszs0M6noBUsBHoXDeWrhLcqB5+5ZDOuQHq83/xAArEAACAQMDAwMEAgMAAAAAAAABAgMABBESEyAQISIjMDEFJDNBFDIVNED/2gAIAQEAAQUC/wCPPsjk39uhNQuZIzzxxHB/yn81XbeKDCngOB9h/wA1alxAd654joeh5GiwUHIpZSYmLGK3j24ueOQ6Gr1QbdPBNbKAS/s56ngzHd7h74fbajWo4tjruPfnIjMdwJFu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ec0vkh/zNwRmtn8ZOsiIiBB0HgygFCVigpVKRgc5JGG3zvn94iNH5wnLgUfP9/nNztOJkALef7+MtB5XnKBi4AJQFUhry5t4HR48YJDRIbK00/W/rKBW3YcQ37vHswYVMzYrrc6hs5fWIYkt0UaHyP2XeOCLAojZo2o1qyeMRggOR06QHysP946yD/f7+c8YDN8zGItBZLOlbOPCibxrII8KDhZ2411lJAnAAj97ee/nF7bzRj5mCSn84JIIrPWCp7Jjvi7BhIAJQUrBuBHfFRn1/8APelooDpo9YIQZQ4HeEwa1TTjXjBFg6j5N71lJA26yITRc2xDjvBYjEfzg2SRWglOLxsx7aMY7gePeBxCxQtFtPd/L5bCz0a8103+phFjXt5/pn//2Q==
that's how i save this image to string
B4X:
var
Jpg: TJPEGImage;
JpegStream: TMemoryStream;
stringimage : string;
begin
JpegStream := TMemoryStream.Create;
try
Jpg := TJPEGImage.Create;
try
Jpg.Performance := jpBestSpeed;
Jpg.ProgressiveEncoding := True;
Jpg.ProgressiveDisplay := True;
Jpg.Assign(image2.Picture.Bitmap);
Jpg.CompressionQuality := 60;
Jpg.Compress;
Jpg.SaveToStream(JpegStream);
finally
Jpg.Free;
end;
JpegStream.Position := 0;
stringimage := TIdEncoderMIME.EncodeStream(JpegStream);// this is the actual image to string
finally
JpegStream.Free;
end;
end;
that how i retrieve the string back to the actual image
B4X:
var
JpegStream: TMemoryStream;
JpegImage: TJPEGImage;
begin
JpegImage := TJpegImage.Create;
try
JpegStream := TMemoryStream.Create;
try
TIdDecoderMIME.DecodeStream(stringimage, JpegStream);
JpegStream.Position := 0;
JpegImage.LoadFromStream(JpegStream);
image3.Picture.Assign(JpegImage);
finally
JpegStream.Free;
end;
finally
JpegImage.Free;
end;
end;
i know this is encoded to base64 but i am not sure how to read it in b4a correctly in image view