Cara Convert Image/gambar ke Base64 di embarcadero delphi
Script ini berasal dari group telegram komunitas delphi, silahkan di comot, di bawah ini.
function CodBase64(const ABitmap: TBitmap): string;
var
LInputStream: TBytesStream;
LOutputStream: TStringStream;
begin
Result := '';
if ABitmap.IsEmpty then
Exit;
LInputStream := TBytesStream.Create;
try
ABitmap.SaveToStream(LInputStream);
LInputStream.Position := 0;
LOutputStream := TStringStream.Create('');
try
TNetEncoding.Base64.Encode(LInputStream, LOutputStream);
Result := LOutputStream.DataString;
finally
LOutputStream.Free;
end;
finally
LInputStream.Free;
end;
end;
Post a Comment for "Cara Convert Image/gambar ke Base64 di embarcadero delphi"