Board index » delphi » Storing Jpeg/tiff files within Blob fields

Storing Jpeg/tiff files within Blob fields

I have had severe issues with trying to store Jpeg files/tiff images within
blob fields. Using the DBImage component I have linked to a table components
Blob field I can 'loadfromfile' bmps etc. into the the database. I have
already registered the graphic classes to allow the DBimage to
'loadfromfile' and display the graphic types jpeg/tiff but the database
insists that I cannot save the tjpeg as a graphic within the database. Do I
need to create a stream the insert the data? Any Info would be greatly
appreciated.
 

Re:Storing Jpeg/tiff files within Blob fields


Hi,

use a TBlobStream.
See the OLH for details.

hannes
--
http://www.talknet.de/~hannes.breuer/
"DAN" <dsc...@maine.rr.com> schrieb im Newsbeitrag
news:rtCg5.27898$9E6.155199@newsr1.maine.rr.com...

Quote
> I have had severe issues with trying to store Jpeg files/tiff images
within
> blob fields. Using the DBImage component I have linked to a table
components
> Blob field I can 'loadfromfile' bmps etc. into the the database. I have
> already registered the graphic classes to allow the DBimage to
> 'loadfromfile' and display the graphic types jpeg/tiff but the database
> insists that I cannot save the tjpeg as a graphic within the database. Do
I
> need to create a stream the insert the data? Any Info would be greatly
> appreciated.

Re:Storing Jpeg/tiff files within Blob fields


Quote
On Sat, 29 Jul 2000 11:06:04 -0400, "DAN" <dsc...@maine.rr.com> wrote:
>I have had severe issues with trying to store Jpeg files/tiff images within
>blob fields. Using the DBImage component I have linked to a table components
>Blob field I can 'loadfromfile' bmps etc. into the the database. I have
>already registered the graphic classes to allow the DBimage to
>'loadfromfile' and display the graphic types jpeg/tiff but the database
>insists that I cannot save the tjpeg as a graphic within the database. Do I
>need to create a stream the insert the data? Any Info would be greatly
>appreciated.

Hi :)

I' willing to give you an example with source for D5 and IB5.6
Send me mail....

Shalom,
Mladen M.

Re:Storing Jpeg/tiff files within Blob fields


You can't use a TDBImage, you can only use a TImage and fill the contents
yourself, e.g.:

uses
  Jpeg;

procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
var
  S: TStream;
begin
  if not Assigned(Field) or (Field.FieldName = 'MyJpegField') then
  begin
    S := (Sender as TDataSource).Dataset.CreateBlobStream(
      (Sender as TDataSource).Dataset.FieldByName('MyJpegField'), bmRead);
    try
      if not (Image1.Picture.Graphic is TJpegImage) then
        Image1.Picture.Graphic := TJpegImage.Create;
      Image1.Picture.Graphic.LoadFromStream(S);
    finally
      S.Free;
    end;
  end;
end;

"DAN" <dsc...@maine.rr.com> schreef in bericht
news:rtCg5.27898$9E6.155199@newsr1.maine.rr.com...

Quote
> I have had severe issues with trying to store Jpeg files/tiff images
within
> blob fields. Using the DBImage component I have linked to a table
components
> Blob field I can 'loadfromfile' bmps etc. into the the database. I have
> already registered the graphic classes to allow the DBimage to
> 'loadfromfile' and display the graphic types jpeg/tiff but the database
> insists that I cannot save the tjpeg as a graphic within the database. Do
I
> need to create a stream the insert the data? Any Info would be greatly
> appreciated.

Other Threads