04-16-2023, 11:44 PM
For future reference, IntraWeb has a unit IWImageUtils which has some utility functions to handle this issue:
procedure GraphicToBase64Str(Input: TGraphic; var Output: string);
procedure Base64StrToGraphic(var Input: string; Output: TGraphic);
function CreateGraphicFromBase64Str(var Input: string): TGraphic;
procedure Base64StrToPng(var Input: string; Output: TPngImage);
procedure Base64StrToJpg(var Input: string; Output: TJpegImage);
procedure Base64StrToGif(var Input: string; Output: TGifImage);
function Base64StrToImageFile(var Input, AFileName: string): Boolean;
procedure GraphicToBase64Str(Input: TGraphic; var Output: string);
procedure Base64StrToGraphic(var Input: string; Output: TGraphic);
function CreateGraphicFromBase64Str(var Input: string): TGraphic;
procedure Base64StrToPng(var Input: string; Output: TPngImage);
procedure Base64StrToJpg(var Input: string; Output: TJpegImage);
procedure Base64StrToGif(var Input: string; Output: TGifImage);
function Base64StrToImageFile(var Input, AFileName: string): Boolean;