Link to home
Start Free TrialLog in
Avatar of Kymberley
KymberleyFlag for Australia

asked on

displaying graphic from blob field

In d3 I had a form with a dbimage control connected to a blob/memo field in an apollo Taptable

ie dbimage is a tdbimage
    datasource is the datasource connected to the database containing the bitmaps in its memofield  - "image"
   

i rerieve the size of the image using

   ih:=dbimage1.picture.Graphic.height;
   iw:=dbimage1.picture.Graphic.width;

then display this in a tpaintbox using (via a few subroutines)

   paintbox1.canvas.stretchdraw(rect(i,j,i+ih,j+iw),dbimage1.picture.graphic);

the form was converted to D7 with the aptable replaced by a Tapollotable but otherwise essentially the same.

using the same database for the two programs i find that the values of ih and iw are 0 in the D7 case and no image is displayed.

even manually overriding the size variables just displays an empty rectangle.

I tried to change the D7 version to us a timage rather than a tdbimage but can't work out have to assign the image in the blob field to the image control.

Any ideas why the d3 code  doesn't wrk in D7 or how to work around it?

Thanks

Kymberley

   

ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do as meikl just told you. I do wonder though if the D7 version of Apollo is really backwards compatible with the D3 version of Apollo, especially since the classnames have changed. You might even want to save the blob field to a file and check the contents, just to see if it contains the correct data. Like:
  TBlobField(Dataset.FieldByName('Image')).SaveToFile('C:\Image.bmp');
Then see if it generates a file of more than 0 bytes and if the image is really a valid image.