Jump to content

Update an Image with a base64 string at runtime


DonaldShimoda

Recommended Posts

I need to update an image with a base64 string at runtime.

 

The code "works" but the image dont refesh.

function DecodeImageBase64(aString: String; Imagen: TUniImage): Boolean;

function TdmMainCode.DecodeImageBase64;
var
  lStream   : TMemoryStream;
  aPicture  : TPicture;
begin
  if (aString = '') then
  begin
    Imagen.Hide;
  end
  else
  begin
    try
      lStream := TMemoryStream.Create;
      MimeDecode(aString, lStream);
      lStream.Position := 0;
      aPicture := TPicture.create;
      aPicture.LoadFromStream(lStream);
      Imagen.Picture.Assign(aPicture);
      Imagen.Hide;        <<<--- desesperate try 
      Imagen.Invalidate;  <<<--- desesperate try 
      Imagen.Show;
    finally
      lStream.Free;
      aPicture.Free;
    end;
  end;
end;

Hope somebody can helps.

 

Best regards

 

Link to comment
Share on other sites

Ok, after all my test seems like the TuniImage objects dont works at all when Visible := False, or calling the Hide methof, or resizing via code, or anyelse.

 

The only way to do is resize the navigator.

 

Please let me know if is a bug or theres another way to fix this?

Link to comment
Share on other sites

Well, in my test case with a single image and a button it works. So, i have no idea what exactly is causing the problem and i cant send you teh complete app because it calls a own webservice from another server, requiring install...

 

I'm scrubbing :(

 

I dont know if is teh cause is the amount of images (10), the fact it happens inside a threaded timer, or because is inside a unigui panel... Now start the tedious path to find why this bug happens.

 

Let you know if find any reason there

 

Best regards.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...