Board index » delphi » Seeking DBBitmap but as DBJpeg component, anyone?

Seeking DBBitmap but as DBJpeg component, anyone?

I want to use a blob field for display/saving of Jpegs
in a database.  Does anyone have such a beast?

Thanks for your time.
Graham.

 

Re:Seeking DBBitmap but as DBJpeg component, anyone?


On Wed, 22 Sep 1999 16:27:10 +1000, "Graham Wood"

Quote
<q9421...@mail.connect.usq.edu.au> wrote:
>I want to use a blob field for display/saving of Jpegs
>in a database.  Does anyone have such a beast?

BLOB fields by nature do not care what type of data you store in them. It
is merely raw binary data, a stream of characters. It could be the binary
characters that comprise an executable file or a JPEG image file. Either
way, the BLOB field itself does not care. So, you should already have such
a beast.

The key, though, is how to display that JPEG image data. This cannot be
done using the TDBImage component as it only supports graphics formats
native to the Windows environment, like bitmap and WMF. Graphics formats
not native to Windows, like JPEG and GIF cannot be displayed in a TDBImage.
To display a JPEG image, use the TJPEGImage component instead.

Here is a simple, but working example from one of my applications. This
code is in a handler for a dataset component's AfterScroll event to load
the image data from the BLOB field to a TJPEGImage component each time the
record pointer moves.

  procedure TForm1.Table1AfterScroll(DataSet: TDataSet);
  var
    MS: TMemoryStream;
    J1: TJPEGImage;
  begin
    J1 := TJPEGImage.Create;
    MS := TMemoryStream.Create;
    try
      TBlobField(DataSet.Fields[1]).SaveToStream(MS);
      MS.Seek(soFromBeginning, 0);
      with J1 do begin
        PixelFormat := jf24Bit;
        Scale := jsFullSize;
        Grayscale := False;
        Performance := jpBestQuality;
        ProgressiveDisplay := True;
        ProgressiveEncoding := True;
        LoadFromStream(MS);
      end;
      Image1.Picture.Graphic.Assign(J1);
    finally
      J1.Free;
      MS.Free;
    end;
  end;

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Re:Seeking DBBitmap but as DBJpeg component, anyone?


On Thu, 23 Sep 1999 16:57:22 GMT, koter...@NOSPAMgte.net (Steve

Quote
Koterski) wrote:
>On Wed, 22 Sep 1999 16:27:10 +1000, "Graham Wood"
><q9421...@mail.connect.usq.edu.au> wrote:

>>I want to use a blob field for display/saving of Jpegs
>>in a database.  Does anyone have such a beast?

>BLOB fields by nature do not care what type of data you store in them. It
>is merely raw binary data, a stream of characters. It could be the binary
>characters that comprise an executable file or a JPEG image file. Either
>way, the BLOB field itself does not care. So, you should already have such
>a beast.

>The key, though, is how to display that JPEG image data. This cannot be
>done using the TDBImage component as it only supports graphics formats
>native to the Windows environment, like bitmap and WMF. Graphics formats
>not native to Windows, like JPEG and GIF cannot be displayed in a TDBImage.
>To display a JPEG image, use the TJPEGImage component instead.

Steve, know this is a little off-topic, but can you tell me what
versions of CBuilder, if any, contain the TJPEGImage component?

I have Delphi 1 and 2 & CBuilder 1 & 3.  I really though CBuilder 3
would have it.  If not in CBuilder, does in come in the Delphi
Standard editions?  

I'm doing some cludgy things to display jpg's and would perfer
a VCL solution.

gcouch

Re:Seeking DBBitmap but as DBJpeg component, anyone?


On 23 Sep 1999 19:20:00 PDT, gcouch <gene...@ix.netcom.com> wrote:

Quote
>Steve, know this is a little off-topic, but can you tell me what
>versions of CBuilder, if any, contain the TJPEGImage component?

>I have Delphi 1 and 2 & CBuilder 1 & 3.  I really though CBuilder 3
>would have it.  If not in CBuilder, does in come in the Delphi
>Standard editions?  

>I'm doing some cludgy things to display jpg's and would perfer
>a VCL solution.

Ooh. I cannot really remember which version of Delphi and C++Builder
introduced this component. I believe Delphi 3, which would mean that
C++Builder 3 should have it. But the edition used might make the
difference. It is possible that it did not come in the low-end Standard
edition. If you have C++Builder 3 Standard and no JPEG.DCU file, then I
would assume this is a Standard edition thing.

If your Delphi and C++Builder do not have it, there are a number of
third-party equivalents available.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Re:Seeking DBBitmap but as DBJpeg component, anyone?


On Fri, 24 Sep 1999 16:48:26 GMT, koter...@NOSPAMgte.net (Steve

Quote
Koterski) wrote:
>On 23 Sep 1999 19:20:00 PDT, gcouch <gene...@ix.netcom.com> wrote:

>>Steve, know this is a little off-topic, but can you tell me what
>>versions of CBuilder, if any, contain the TJPEGImage component?

>>I have Delphi 1 and 2 & CBuilder 1 & 3.  I really though CBuilder 3
>>would have it.  If not in CBuilder, does in come in the Delphi
>>Standard editions?  

>>I'm doing some cludgy things to display jpg's and would perfer
>>a VCL solution.

>Ooh. I cannot really remember which version of Delphi and C++Builder
>introduced this component. I believe Delphi 3, which would mean that
>C++Builder 3 should have it. But the edition used might make the
>difference. It is possible that it did not come in the low-end Standard
>edition. If you have C++Builder 3 Standard and no JPEG.DCU file, then I
>would assume this is a Standard edition thing.

>If your Delphi and C++Builder do not have it, there are a number of
>third-party equivalents available.

All my versions are Pro.  Just brought up the standard edition as
a cheap way to get the component.  If in CBuilder 4, it would give
me an excuse to upgrade.  But I don't want to do it and find out
it's only in Delphi.

Thanks anyway.

gcouch

Other Threads