Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Loading image from database field

edited August 2004 in General
I am using RB I am using RB 7.04, the end user report creator.

I am trying to use the dbimage component and have it autosize to the actual
size of the image. I understand that autosize doesn't work, but I need this
functionality. I also understand that the ppimage component does support
autosize, but I don't know how to load the image from a database field using
the end user report tool.

Can anyone help me?

Thanks,

Yelena

Comments

  • edited August 2004
    Hi Yelena,

    Sorry, the Autosize feature for the DBImage will be added in the next
    release of ReportBuilder. You can load an image into a normal TppImage
    component from database using the GetFieldAsPicture method of the
    datapipeline. For instance in the DetailBandBeforePrint event you could...

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    begin

    ppImage1.Picture := ppReport1.DataPipeline.GetFieldAsPicture('BMP');

    end;

    If you then set the TppImage to AutoSize, you should get the desired effect.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    Yelena is using the end-user tool and not Delphi so she has no visibility to
    GetFieldAsPicture.

    Is there another way to do this through just the end-user reporting
    solution?

    Is there a way to assign the picture in the DBImage component to the ppImage
    component?

    Dan


  • edited August 2004
    Dan,

    Unfortunately there is no way to do this from the end-user environment. It
    may be possible to load the image contained in a DBImage component to a
    TppImage component, but this would require some Delphi code as well.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    I know the size of the graphic as it is stored in the database. Is there a
    formula that I can use in the end user tool to convert the pixel size to
    microns and what event would I have to do this in, or is this not possible
    in the end user environment.

    Also, when you say next version are you talking major or minor and do you
    have any anticipated time frame.

    Thanks,
    Dan

  • edited August 2004
    Hi Dan,

    I'm unclear about why this must be done in the end-user environment. Are
    you using a version of ReportBuilder that has been included with another
    application? As you can see from the example I gave below, it is very easy
    to load an image from a database into a TppImage component. To do something
    similar in RAP, you would need to create a PassThru function (in Delphi
    code).

    If you know the size of the image before you load the DBImage, you could use
    the Band.BeforePrint event to set the size of the DBImage component
    accordingly. If you need to convert to microns... there are 25400 microns
    per inch. You can use this number to calculate the width and height based
    on the pixels per inch of your screen.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.