BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to display a jpeg image from blob field in tdbimage...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
Markcr
Guest





PostPosted: Mon Jul 03, 2006 7:05 pm    Post subject: how to display a jpeg image from blob field in tdbimage... Reply with 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





PostPosted: Tue Jul 04, 2006 2:25 am    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote



"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





PostPosted: Tue Jul 04, 2006 1:53 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote



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





PostPosted: Tue Jul 04, 2006 2:53 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote

"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> wrote:
Quote:
It is already included. I can load a jpeg into a TImage but not a TDBImage


Take a look at

http://groups.google.pt/group/borland.public.cppbuilder.database.sqlservers/browse_frm/thread/c6e5f1fe144c7bb9/b40d8eac389a4125?lnk=st&q=builder+jpeg+tdbimage&rnum=6&hl=pt-PT#b40d8eac389a4125

HTH
Antonio
Back to top
Markcr
Guest





PostPosted: Tue Jul 04, 2006 3:28 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with 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?


"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote in message
news:44aa3a93$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Markcr" <markcr (AT) ntlworldminusthistext (DOT) com> wrote:
It is already included. I can load a jpeg into a TImage but not a TDBImage


Take a look at

http://groups.google.pt/group/borland.public.cppbuilder.database.sqlservers/browse_frm/thread/c6e5f1fe144c7bb9/b40d8eac389a4125?lnk=st&q=builder+jpeg+tdbimage&rnum=6&hl=pt-PT#b40d8eac389a4125

HTH
Antonio
Back to top
Antonio Felix
Guest





PostPosted: Tue Jul 04, 2006 6:42 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote

"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





PostPosted: Tue Jul 04, 2006 7:36 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote

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





PostPosted: Wed Jul 05, 2006 3:11 am    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with 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?

--
---------------------------------------
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





PostPosted: Wed Jul 05, 2006 3:18 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote

"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





PostPosted: Wed Jul 05, 2006 10:15 pm    Post subject: Re: how to display a jpeg image from blob field in tdbimage. Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.