 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Markcr Guest
|
Posted: Mon Jul 03, 2006 7:05 pm Post subject: how to display a jpeg image from blob field in tdbimage... |
|
|
I realise that this has been asked a few times in various ways, including by
me, but how can i display a jpeg image stored in a blob filed in a tdbimage
component? I am using paradox table and c++builder 6
Can the TDBImage be changed to have functions which display a jpeg image (it
errors with an invalid nitmap image currently)
Most example I have googled use Delphi code, which is no use for me. |
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Tue Jul 04, 2006 2:25 am Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> escreveu na mensagem
news:44a92428$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I realise that this has been asked a few times in various ways, including
by me, but how can i display a jpeg image stored in a blob filed in a
tdbimage component? I am using paradox table and c++builder 6
Can the TDBImage be changed to have functions which display a jpeg image
(it errors with an invalid nitmap image currently)
Most example I have googled use Delphi code, which is no use for me.
|
Hi,
Just include the JPeg.hpp Header file
( at least with BCB5 - Presumed it stills the same )
HTH
Antonio |
|
| Back to top |
|
 |
Markcr Guest
|
Posted: Tue Jul 04, 2006 1:53 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
It is already included. I can load a jpeg into a TImage but not a TDBImage
"Antonio Felix" <antoniojfelix (AT) maisspamnao (DOT) clixempt> wrote in message
news:44a98b21 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> escreveu na mensagem
news:44a92428$1 (AT) newsgroups (DOT) borland.com...
I realise that this has been asked a few times in various ways, including
by me, but how can i display a jpeg image stored in a blob filed in a
tdbimage component? I am using paradox table and c++builder 6
Can the TDBImage be changed to have functions which display a jpeg image
(it errors with an invalid nitmap image currently)
Most example I have googled use Delphi code, which is no use for me.
Hi,
Just include the JPeg.hpp Header file
( at least with BCB5 - Presumed it stills the same )
HTH
Antonio
|
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
|
| Back to top |
|
 |
Markcr Guest
|
Posted: Tue Jul 04, 2006 3:28 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
OK, I put the code in the form create, but I still get Bitmap image is not
valid when I open the database.
Should the code live somehwere else?
"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote in message
news:44aa3a93$1 (AT) newsgroups (DOT) borland.com...
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Tue Jul 04, 2006 6:42 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> wrote:
| Quote: | OK, I put the code in the form create, but I still get Bitmap image is not
valid when I open the database.
Should the code live somehwere else?
|
Don't use the Form Create, use it in the form constructor.
Are you shure that you have a valid jpeg in the Blob field?
Br
Antonio |
|
| Back to top |
|
 |
Markcr Guest
|
Posted: Tue Jul 04, 2006 7:36 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
I am sure. If i savetofile and then loadfromfile in a TImage I have no
problems, but I want to cut out the savetofileand loadfromfile section,
"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote in message
news:44aa7039$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> wrote:
OK, I put the code in the form create, but I still get Bitmap image is not
valid when I open the database.
Should the code live somehwere else?
Don't use the Form Create, use it in the form constructor.
Are you shure that you have a valid jpeg in the Blob field?
Br
Antonio |
|
|
| Back to top |
|
 |
Mark Richards Guest
|
Posted: Wed Jul 05, 2006 3:11 am Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
Does anyone have a wroking code that can access a TBlobField, save it to a
memory stream, and then load it into a TImage?
--
---------------------------------------
And a pointless sig...
---------------------------------------
There are 10 types of people in the world
those that understand binary and those that don't
"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> wrote in message
news:44a92428$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I realise that this has been asked a few times in various ways, including
by me, but how can i display a jpeg image stored in a blob filed in a
tdbimage component? I am using paradox table and c++builder 6
Can the TDBImage be changed to have functions which display a jpeg image
(it errors with an invalid nitmap image currently)
Most example I have googled use Delphi code, which is no use for me.
|
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Wed Jul 05, 2006 3:18 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
"Mark Richards" <markcr (AT) wapthespamntlworld (DOT) com> wrote:
| Quote: | Does anyone have a wroking code that can access a TBlobField, save it to a
memory stream, and then load it into a TImage?
|
....
if ( !Dm->IBSU->FieldByName("PGraph")->IsNull ) {
TJPEGImage *Jp;
TMemoryStream *Blob;
try {
Jp = new TJPEGImage();
Blob = new TMemoryStream();
Dm->IBSU->FieldByName("PGraph")->SaveToStream( Blob );
Blob->Position = 0;
Jp->LoadFromStream( Blob );
IPGraph->Picture->Bitmap->Assign( Jp );
delete Blob;
delete Jp;
}
catch( Exception &E ) {
FxMsgE( Application->Handle, "Imagem:", "Cannot Load Image.", E );
delete Blob;
delete Jp;
}
} else
IPGraph->Picture->Metafile->Clear();
...
IPGraph = TImage
Dm->IBSU = TIBSQL on a DataModule ( change it by your Dataset )
HTH
Antonio |
|
| Back to top |
|
 |
Markcr Guest
|
Posted: Wed Jul 05, 2006 10:15 pm Post subject: Re: how to display a jpeg image from blob field in tdbimage. |
|
|
thanks, I will implement that later. Ditched the dbimage control, so that
should work better, at least it cuts out opening files.
"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote in message
news:44ab9203$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Mark Richards" <markcr (AT) wapthespamntlworld (DOT) com> wrote:
Does anyone have a wroking code that can access a TBlobField, save it to
a
memory stream, and then load it into a TImage?
...
if ( !Dm->IBSU->FieldByName("PGraph")->IsNull ) {
TJPEGImage *Jp;
TMemoryStream *Blob;
try {
Jp = new TJPEGImage();
Blob = new TMemoryStream();
Dm->IBSU->FieldByName("PGraph")->SaveToStream( Blob );
Blob->Position = 0;
Jp->LoadFromStream( Blob );
IPGraph->Picture->Bitmap->Assign( Jp );
delete Blob;
delete Jp;
}
catch( Exception &E ) {
FxMsgE( Application->Handle, "Imagem:", "Cannot Load Image.",
E );
delete Blob;
delete Jp;
}
} else
IPGraph->Picture->Metafile->Clear();
..
IPGraph = TImage
Dm->IBSU = TIBSQL on a DataModule ( change it by your Dataset )
HTH
Antonio |
|
|
| 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
|
|