Solved

how to load a blobfield from a firebird table into an image

Posted on 2014-04-06
4
388 Views
Last Modified: 2014-04-12
Hi, can anyone help me how to load the value of a blobfield into an image ?

thx
Mario
0
Comment
Question by:marioway
[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
4 Comments
 
LVL 19

Expert Comment

by:NickUpson
ID: 39981736
you might do better asking in the interbase/firebird database area.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 39981831
Also if the code should be in Delphi then I would recommend Delphi zone...

OTOH, you could use FoxPro because the code is then very simple:
lnHandle = SQLCONNECT()
IF lnHandle > 0
  lnResult = SQLEXEC(lnHandle, "SELECT YourBlobField FROM YourTable WHERE SomeCondition", "cOutput")
  IF lnResult > 0
    *-- Save blob from the first record to image file
    SELECT cOutput
    GO TOP
    COPY MEMO YourBlobField TO d:\path\imagefile.ext
  ELSE
    *-- Process error
  ENDIF
  = SQLDISCONNECT(lnHandle)
ENDIF

Open in new window

0
 

Accepted Solution

by:
marioway earned 0 total points
ID: 39982787
Hi guys, I found my own solution , works fine for me

procedure TIkoonfact.DBGrid1DblClick(Sender: TObject);
var Blobstream: TMemorystream;
    Bitmap: TBitmap;
    Field: TBlobField;
begin
 with Datamodule1 do begin
     //inladen opgeslagen beeld
  try
   Blobstream := TMemoryStream.Create;
   Bitmap := TBitmap.Create;
   Field := TBlobField(Foto1query.FieldByName('FOTOKES'));
   Field.SaveToStream(Blobstream);
   Blobstream.Position := 0;
   Bitmap.LoadFromStream(Blobstream);
   Image2.Picture.Assign(Bitmap);
  finally
   Blobstream.Free;
   Bitmap.Free;
  end;
 end;
end;

Open in new window

0
 

Author Closing Comment

by:marioway
ID: 39995871
I did not get a solution to my question.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 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