Solved

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

Posted on 2014-04-06
4
379 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access Keep Subform Locked Until Main Form Is Completed 25 64
MS Access 2003 Query 2 52
Slow SQL query 12 55
How to load 2 images in same column in Delphi 2 35
Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now