Solved

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

Posted on 2014-04-06
4
376 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
  • 2
4 Comments
 
LVL 19

Expert Comment

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Database tuning – How to start and what to tune. This question is frequently asked by many people, both online and offline. There is no hard and fast rule-of-thumb for performance tuning, however, before beginning the tuning process one should a…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now