Solved

displaying graphic from blob field

Posted on 2004-08-23
2
365 Views
Last Modified: 2010-04-05
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

   

0
Comment
Question by:Kymberley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 11878224
well, cannot reproduce,

but you could try this way

var
  b : TBitmap;
  m : TmemoryStream;
begin
  b := TBitmap.Create;
  m := TmemoryStream.Create;
  try
    TBlobField(Dataset.FieldByName('Image')).SaveToStream(m);
    m.position := 0;
    b.LoadFromStream(m);
    //do your painting now
  finally
    b.free;
    m.free;
  end;
end;

just from head

meikl ;-)
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11883760
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.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question