Board index » delphi » Looking for JPEG DBImage

Looking for JPEG DBImage

I'm looking for some component which can work like DBImage but can read and
save JPEG files into BLOB field in the database. It's my first application
with images so maybe also DBImage can do it but I don't know how.
Any ideas ?
thx
 

Re:Looking for JPEG DBImage


Quote
In article <3b55a159_1@dnews>, Jaro wrote:
> I'm looking for some component which can work like DBImage but can read and
> save JPEG files into BLOB field in the database. It's my first application
> with images so maybe also DBImage can do it but I don't know how.

TDBImage can only save and load TBitmaps. But you can add JPEG to your uses
clause and create an instance of TJPEGImage. You can use its LoadFromFile
method to load a file into it, you can use its SaveToStream and
LoadFromStream methods to save/load it into/from a TBlobStream attached to a
blobfield. To display the image assign it to a TImages Picture.Graphics
property. To change the image when the user scrolls through the dataset use
the datasets AfterScroll event to load the next image.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Re:Looking for JPEG DBImage


Thanks.
Another problem is what to do if I want to have possibility to fill in the
image by paste from clipboard and save it to the database. Is there some
"trick" how to do it easyly ? (or maybe not easyly :))
Thanks
Jaro

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.000074ed.00419bf3@antispam.compuserve.com...

Quote
> In article <3b55a159_1@dnews>, Jaro wrote:
> > I'm looking for some component which can work like DBImage but can read
and
> > save JPEG files into BLOB field in the database. It's my first
application
> > with images so maybe also DBImage can do it but I don't know how.

> TDBImage can only save and load TBitmaps. But you can add JPEG to your
uses
> clause and create an instance of TJPEGImage. You can use its LoadFromFile
> method to load a file into it, you can use its SaveToStream and
> LoadFromStream methods to save/load it into/from a TBlobStream attached to
a
> blobfield. To display the image assign it to a TImages Picture.Graphics
> property. To change the image when the user scrolls through the dataset
use
> the datasets AfterScroll event to load the next image.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!
> Note: I'm unable to visit the newsgroups every day at the moment,
> so be patient if you don't get a reply immediately.

Re:Looking for JPEG DBImage


Quote
In article <3b56911c$1_2@dnews>, Jaro wrote:
> Another problem is what to do if I want to have possibility to fill in the
> image by paste from clipboard and save it to the database.

The clipboard supports only bitmaps and metafiles as graphic formats. Do you
want to store the graphic in its original format or as JPEG? If you want to
store a mix of possible graphics format into your database you need to store
additional information that allows you to figure out which graphic format
you have in a record. It is not possible to do that with the streamed data
alone.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Re:Looking for JPEG DBImage


I want to store all images as JPEG even if image is displayed as BMP. Only
what I need is reasonable size in the database. When I stored BMP it was
toooo slow and I never got whole image. I have MaxBlobSize = set to -1.
thanks
Jaro

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.000074f7.006da792@antispam.compuserve.com...

Quote
> In article <3b56911c$1_2@dnews>, Jaro wrote:
> > Another problem is what to do if I want to have possibility to fill in
the
> > image by paste from clipboard and save it to the database.

> The clipboard supports only bitmaps and metafiles as graphic formats. Do
you
> want to store the graphic in its original format or as JPEG? If you want
to
> store a mix of possible graphics format into your database you need to
store
> additional information that allows you to figure out which graphic format
> you have in a record. It is not possible to do that with the streamed data
> alone.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!
> Note: I'm unable to visit the newsgroups every day at the moment,
> so be patient if you don't get a reply immediately.

Re:Looking for JPEG DBImage


Quote
In article <3b57da73$1_2@dnews>, Jaro wrote:
> I want to store all images as JPEG even if image is displayed as BMP.

Ok, so it boils down to converting a bitmap to JPEG.

  Var
    bmp: TBitmap;
    jpeg: TJPegImage;
  Begin
    bmp:= TBitmap.Create;
    try
      bmp.Assign( Clipboard );
      jpeg:=TJPegImage.Create;
      try
        jpeg.Assign( bmp );
        SaveJPegToDatabase( jpeg );
      finally
        jpeg.free
      end
    finally
      bmp.free
    end;
  End;  

Of course you have to check first that the clipboard does indeed contain a
bitmap (Clipboard.hasFormat).

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Other Threads