Show jpeg from database in TFrxPictureView

edited June 2017 in FastReport 4.0
I am converting from Quickreport to Fastreport.
In QR I used a blobstream to read a jpeg-blob from a database to a TQRImage using this code in OnBeforePrint event:
var
  bS: TStream;
  Pic: TJPEGImage;


   bS := [database].CreateBlobStream([database].FieldByName('picture'), bmRead);
      try
        Pic := TJPEGImage.Create;
        try
          Pic.LoadFromStream(bS); // Load jpeg from stream into Pic.
          TQRImage(FindComponent('QRImage' + IntToStr(i + 1))).Picture.Bitmap.Assign(Pic); // Put Pic into Quickreport - Qrimage.
        finally
            Pic.Free
        end;
      finally;
        bS.Free

This does not work with Fastreport.

Can anybody please advise how to proceed?

Comments

  • gordkgordk St.Catherines On. Canada.
    edited June 2017
    tfrxpictureview can connect to a blob field or use loadfromstream or loadfrom file methods
    tfrxpictureview.picture.loadfromstream
  • edited 4:45PM
    thanks gordk but how do I store the blob to stream first so that I can later import it to FrxPictureview?
    I know how to do it in Delphi but I need to do it in FR OnBeforePrint event where
    var
    stream: TStream;
    
    stream := <database>.CreateBlobStream(qPictures.FieldByName('picture'), bmRead);
    

    does not work.
    ?
  • gpigpi
    edited 4:45PM
    Try to use TfrxPictureView.LoadPictureFromStream()

Leave a Comment