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 11:20AM
    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 11:20AM
    Try to use TfrxPictureView.LoadPictureFromStream()

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.