Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Using jpegs rather than bmps but I have deployed apps with a "graphics" field
Mon, Apr 9 2007 5:20 AMPermanent Link

David
For obvious size reasons, I would like to start using jpegs rather than bmps in my
program.  Unfortunately, the database field I currently store the image in is a "Graphic"
type rather than "BLOB".  Fortunately (for me), I have quite a few copies already
deployed.  Unfortunately, that means I just can't simply change the field.

So I have a few questions

1)  Can the 'graphics' field type store a jpeg?
2)  Can the TDBImage component display a jpeg?  Currently I can load a jpg from a file
into the component but when I try to save the record it doesn't save the image.
3)  Do I only need to add the 'jpeg' unit to the 'uses' clause to use jpegs in a delphi
app?  OR must I do more?
4)  Will the quickreport QRDBImage component understand jpegs as well?
5)  Can I keep the data type as "graphic" or will I need to convert to BLOB?  And if I
need to, how difficult is it?
6)  Am I missing anything here?

I apologize for the large number of questions but it is 4 AM here.  Smile

Thanks for any help.

Cheers,
David

Mon, Apr 9 2007 7:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

David

Answers NOT guaranteed Smiley

>1) Can the 'graphics' field type store a jpeg?
YES. All the momo type fields are basically the same and you can stuff anything into any of them. I personally use a straight MEMO for text, tables and jpegs

>2) Can the TDBImage component display a jpeg? Currently I can load a jpg from a file
>into the component but when I try to save the record it doesn't save the image.
Dunno. What I do is  

  FileIn := TFileStream.Create(GetFiles.Files[Cntr], fmOpenRead or fmShareDenyNone);
 TMemoField(AttachmentList.FieldByName('_Item')).LoadFromStream(FileIn);

It may be that the TDBImage is one way ie will fill from a table but won't update the table

>3) Do I only need to add the 'jpeg' unit to the 'uses' clause to use jpegs in a delphi
>app? OR must I do more?
This is old code (D4 vintage) so might not be necessary any more

try
 Photo.Picture.LoadFromFile(LookUpID);  <<<<<<<<< TImage
 PhotoFrame.Visible := True;
except
 on EInvalidGraphic do begin
  try
   TJPEGImage(Photo.Picture).LoadFromFile(LookUpID);
   PhotoFrame.Visible := True;
  except
   PhotoFrame.Visible := False;
  end;
 end;
end;

>4) Will the quickreport QRDBImage component understand jpegs as well?
Pass

>5) Can I keep the data type as "graphic" or will I need to convert to BLOB? And if I
>need to, how difficult is it?
Yes and so no and easy

>6) Am I missing anything here?
Only your sleep Smiley


Roy Lambert
Mon, Apr 9 2007 8:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

<< 1)  Can the 'graphics' field type store a jpeg? >>

Yes.

<< 2)  Can the TDBImage component display a jpeg?  Currently I can load a
jpg from a file into the component but when I try to save the record it
doesn't save the image. >>

See here:

http://www.elevatesoft.com/scripts/newsgrp.dll?action=openmsg&group=5&msg=41818&page=1#msg41818

<< 3)  Do I only need to add the 'jpeg' unit to the 'uses' clause to use
jpegs in a delphi app?  OR must I do more?
>>

Well, you have to do some extra loading/saving since only TImage supports
JPEGs, and not the TDBImage.  Therefore, you'll need to re-load the
applicable image from the BLOB field when the user scrolls, etc.

<< 4)  Will the quickreport QRDBImage component understand jpegs as well? >>

You'll have to check with the QR docs, but I believe it does.

<< 5)  Can I keep the data type as "graphic" or will I need to convert to
BLOB?  And if I need to, how difficult is it? >>

You can keep it as a graphic type.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 12 2007 2:58 AMPermanent Link

David
Thanks for all the replies, guys.

I ended up cheating.  I took the easy way out and purchased these components

http://www.mwasoftware.co.uk/index.php?option=com_content&task=view&id=3&Ite
mid=12

They work like a champ.
Image