 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ignacio Vazquez Guest
|
Posted: Tue Jul 22, 2003 1:58 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
"bill" <bill (AT) dingey (DOT) com.tw> wrote
| Quote: | // If it is a JPG file , it can't show correctly, but BMP file is OK!
|
Did you add jpeg to the uses clause?
Cheers,
Ignacio
|
|
| Back to top |
|
 |
Dennis Passmore Guest
|
Posted: Tue Jul 22, 2003 5:09 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
Once you load a JPEG into a TImage it becomes a BMP and when you store it into the MsSql
server it is stored as a BMP so when you attempt to read it out as a Jpeg it is the wrong
format.
Try using a TJpegImage instead of TImage.
Dennis Passmore
Ultimate Software, Inc.
|
|
| Back to top |
|
 |
Norman McFarlane Guest
|
Posted: Tue Jul 22, 2003 8:16 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
excuse my obvious ignorance, but where does one find the TJPEGIMAGE, and is
it a visual component? i'm using D6.
i am writing an image manager in D6, and whilst i can save any image to an
ms sql 2000 database, when i try to load a jpeg image from the database, the
TADODataset fails on executing the Open method with the error message
"Bitmap image is not valid".
any suggestions?
<Dennis Passmore> wrote
| Quote: | Once you load a JPEG into a TImage it becomes a BMP and when you store it
into the MsSql
server it is stored as a BMP so when you attempt to read it out as a Jpeg
it is the wrong
format.
Try using a TJpegImage instead of TImage.
Dennis Passmore
Ultimate Software, Inc.
|
|
|
| Back to top |
|
 |
bill Guest
|
Posted: Wed Jul 23, 2003 12:43 am Post subject: Re: How to save a JPG file to MSSQL |
|
|
Yes, I do.
bill
"Ignacio Vazquez" <ivazquezATorioncommunications.com> ¼¶¼g©ó¶l¥ó
news:3f1d4308 (AT) newsgroups (DOT) borland.com...
| Quote: | "bill" <bill (AT) dingey (DOT) com.tw> wrote
// If it is a JPG file , it can't show correctly, but BMP file is OK!
Did you add jpeg to the uses clause?
Cheers,
Ignacio
|
|
|
| Back to top |
|
 |
bill Guest
|
Posted: Wed Jul 23, 2003 6:13 am Post subject: Re: How to save a JPG file to MSSQL |
|
|
Dennis,
Sorry, I still have some questions.
1. How to code to save JPG file to MSSQL with TJPEGImage?
Because i just know the way of BMP file:
m_ADOQuery1.Edit;
pBlob := m_ADOQuery1.FieldByName('GraphyField') as TBlobField;
try
pBlob.Assign(Image1.Picture.Bitmap);
finally
end;
m_ADOQuery1.Post;
2. How to read it from MSSQL(JEP File), and show it on TImage ?
Thanks.
bill
<Dennis Passmore> ????? news:nfdqhvohcq9r79m0b4vhggqt1f57750ac8 (AT) 4ax (DOT) com...
| Quote: | Once you load a JPEG into a TImage it becomes a BMP and when you store it
into the MsSql
server it is stored as a BMP so when you attempt to read it out as a Jpeg
it is the wrong
format.
Try using a TJpegImage instead of TImage.
Dennis Passmore
Ultimate Software, Inc.
|
|
|
| Back to top |
|
 |
Dennis Passmore Guest
|
Posted: Wed Jul 23, 2003 2:46 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
See example project "Jpegloader.zip" in borland.public.attachments
Dennis Passmore
Ultimate Software, Inc.
|
|
| Back to top |
|
 |
Norman McFarlane Guest
|
Posted: Thu Jul 24, 2003 7:40 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
thanks for the example dennis, but i find that when i click the load from
sql button, i get an av on the following line of code:
TJPEGImage(Image1.Picture.Graphic).assign(fJPEGImage);
though i find if i have clicked the load from file button first, the av does
not happen. any thoughts?
norman
<Dennis Passmore> wrote
| Quote: | See example project "Jpegloader.zip" in borland.public.attachments
Dennis Passmore
Ultimate Software, Inc.
|
|
|
| Back to top |
|
 |
bill Guest
|
Posted: Fri Jul 25, 2003 1:38 am Post subject: Re: How to save a JPG file to MSSQL |
|
|
Dennis,
I check on http://www.borland.com/public.attachments,
but still can't find the "example project" or "Jpegloader.zip".
Could you help me!
Thanks! bill
<Dennis Passmore> ????? news:cr7thvkpdn995kl3e8evjm8al4d9if5c4d (AT) 4ax (DOT) com...
| Quote: | See example project "Jpegloader.zip" in borland.public.attachments
Dennis Passmore
Ultimate Software, Inc.
|
|
|
| Back to top |
|
 |
Norman McFarlane Guest
|
Posted: Fri Jul 25, 2003 7:01 am Post subject: Re: Re: How to save a JPG file to MSSQL |
|
|
hi dennis,
sorry for being a pest, but i still get an error message, this time "jpeg
error #41". i am using d6 btw.
regards,
norman
<Dennis Passmore> wrote
| Quote: | any ideas..
Yes, for some reason Delphi 5 does not handle it very well but Delphi 6 &
7 do.
try this instead. It works in all cases..
if (pos('.jpg',ADODataSet1Description.asstring)>0) then
begin
fJPEGImage := TJPEGImage.create;
fJPEGImage.LoadFromStream(Stream);
Image1.Picture.Graphic := fJPEGImage;
end
else
Image1.Picture.Bitmap.LoadFromStream(Stream);
Dennis Passmore
Ultimate Software, Inc.
|
|
|
| Back to top |
|
 |
Joris Guest
|
Posted: Fri Jul 25, 2003 5:21 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
"Norman McFarlane" <norman (AT) redpoint (DOT) co.za> wrote
| Quote: | TJPEGImage(Image1.Picture.Graphic).assign(fJPEGImage);
|
As far as I know, the quoted line is a bug. TPicture is a TGraphic container. If it
doesn't already contain anything, Picture.Graphic is nil. Assigning to nil should
indeed cause an AV. Change it to
Image1.Picture.Assign(fJPEGImage)
Joris
|
|
| Back to top |
|
 |
Charles Hacker Guest
|
Posted: Sun Jul 27, 2003 9:44 pm Post subject: Re: How to save a JPG file to MSSQL |
|
|
Norman McFarlane wrote:
| Quote: |
hi dennis,
sorry for being a pest, but i still get an error message, this time "jpeg
error #41". i am using d6 btw.
|
Take a look at:
http://www.efg2.com/Lab/Library/Delphi/Graphics/JpegErrors.txt
--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|