Printing pictures

I have a database picture field (Firebird 1.5 blob subtype 0) and it have assigned .bmp or .jpg pictures.
I have a TfrPictureView and, if I set BlobType to btBMP and try to show .bmp pictures, I get a lot of "bitmap image is not valid" messageboxes but pictures are shown, (this error can be produced by empty picture fields in database).
If I set BlobType to btJPG ({define JPEG} is enabled), and I try to show .jpg pictures, I get a "JPEG error #53" and nothing is shown
If I try to show .jpg when BlobType is btJPG or I try to show .bmp when BlobType is btBMP I get an error too

What can I do to show both two .jpg and .bmp pictures stored in my database?

Comments

  • edited 10:35AM
    I think you can write in TfrReport.BeforePrint

    procedure TForm1.Doc1BeforePrint(Memo: TStringList; View: TView);
    begin
    if Memo.Count > 0 then
    if (Memo[0] = '[Picture]') and (View is TPictureView) then
    'Check the field is null here
    (View as TPictureView).Picture.Assign(Table1Picture);
    end;
  • edited 10:35AM
    THANKS A LOT!!, with your example and some more code, I have solved my problem, thankyou very much, I spent some days trying to make it work, but I couldn't, thanks again
  • edited 10:35AM
    1.Create a TfrPictureView in the frReportDesigner
    2.Set TfrPictureView.Memo Value = [Picture]
    3.Write write in TfrReport.BeforePrint
    like i said

Leave a Comment