TDBAdvGrid PNG

Hello,

I'm using new version TDBAdvGrid version 2.3.4.0 Jan, 2013 for Delphi XE2

But actually when I display a png picture, I get the picture of a red Cross indicating me that this is not a correct picture...

I have other image display components that can show the png pictures from my database so I know they're not to blame (like DBImageEn)

I did the correct ('hope not...) configuration, as shown in FAQ, to display those with no luck :
DBAdvGrid.ShowPictureFields = true
DBAdvGrid.Columns[columnindex].PictureField = true

Does the new version really handle PNGs ? is there a new parameter hidden somewhere ?

Thanks in advance for your help !!

Internally, this is handled by a TPicture that should support PNG in XE2 when you add the unit PngImage to the uses list. I assume your PNG images are stored in BLOB fields?



Hello Bruno,

Thanks for answering me ^^

Yes, PNG are stored in Blob fields of a Firebird Database. I tried JPG and GIF and they are displayed correctly.

I didn't knew about the PngImage Library; Unfortunately it didn't change the result... If it's an unavoidable step, i think that could be added to the TDBAdvGrid FAQ http://www.tmssoftware.com/site/dbadvgrd.asp?s=faq&show=531

Any other requirement ? or maybe there's a link between TDBAdvGrid and this library that needs to be set somewhere ?

PNGs are stored in a blob sub_type 0 of a Firebird v2.5.1 database, and are displayed correctly with many other tools.
If I mix png, jpg and gif pictures, only jpg and gif are displayed correctly and png are replaced by cross.

I still need help to display correctly PNG images ! what may I have missed ?

We cannot see any issue with PNG here.
Drop a TClientDataSet & TDBAdvGrid on the form and add the following code:


begin
  with ClientDataSet1.FieldDefs do
  begin
    Add('Name', ftString, 20, False);
    Add('City', ftString, 20, False);
    Add('Country', ftString, 20, False);
    Add('Image',ftGraphic);
  end;
  ClientDataSet1.CreateDataSet;

  clientdataset1.Insert;
  clientdataset1.Fields[0].AsString := 'Embarcadero';
  clientdataset1.Fields[1].AsString := 'San Francisco';
  clientdataset1.Fields[2].AsString := 'USA';
  (clientdataset1.Fields[3] as TBlobField).LoadFromFile('c:\temp\SAMPLEGRIDPNG.png');
  clientdataset1.Post;

  datasource1.DataSet := clientdataset1;

  dbadvgrid1.ShowPictureFields := true;
  dbadvgrid1.datasource := datasource1;
  clientdataset1.Active := true;
end;

This shows the PNG image in the grid.

Thank you ! ftGraphic on the blob field definition on the dataset was the answer, and not ftBlob as I expected...

Now it works perfectly for me ^^ but GIF won't be displayed any more in this case (PNG are OK in both...)



err : Now PNG works perfectly ^^ but GIF won't be displayed any more in this case (JPG are OK in both...)

Thank you.

We have indeed found an issue for the GIF type for Delphi XE2 and have fixed this.
Next update will address this and will also have a new sample app demonstrating the support for various image types