ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 loadFromStream/BLOB

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
adyble Posted - Jun 04 2024 : 08:24:30
Hello
I've looked everywhere but can;t find an example.
Below is my code to load an image form a database. It works ok with the cxImage but I can;t out how to load it into the ImaqeENViewer
Thanks, Andy

procedure TfmMidDBImages.LoadImage();
var
BlobStream: TFDBlobStream;

begin

BlobStream := TFDBlobStream.create(qryImages.FieldByName('IMAGE')
as TBlobField, bmRead);
try
cxImage1.Picture.LoadFromStream(BlobStream);


ImageEnView1.IO.LoadFromStream(BlobStream);

finally
BlobStream.Free;
end;

end;
9   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 07 2024 : 16:15:57
Sorry, I'm not really understanding what you are trying to do here.

TIEDBBitmap inherits all the usual bitmap methods of TIEBitmap, so you can just access the TBitmap as follows:

fDBBitmap.AssignTo( myBMP );

Nigel
Xequte Software
www.imageen.com
adyble Posted - Jun 07 2024 : 10:03:08
Or is it best not to use TIEDBBitmap at all and use TIEBitmap instead ?
adyble Posted - Jun 07 2024 : 10:01:04
Hi Nigel
I that's using TIebitmap but we are using the TIEDBBitmap?

I'm trying -
bmp.Read (fDBBitmap.???? );

I can;t work out how to get the bitmap from the TIEDBBitmap
Andy
xequte Posted - Jun 06 2024 : 21:57:45
Hi

TIEBitmap.Read() and Write() both support stream overloads.

http://www.imageen.com/help/TIEBitmap.Write.html

e.g.

// Output current image to a TImage
bmp := TIEBitmap.Create;
Stream := TMemoryStream.Create;
bmp.Read( 'D:\image.webp' );
bmp.Write( Stream, ioBMP );
Stream.Position := 0;
Image1.Picture.LoadFromStream( Stream );
Stream.Free();
bmp.Free();


Nigel
Xequte Software
www.imageen.com
adyble Posted - Jun 06 2024 : 03:10:21
hi, The db is fine. Its a remote Mysql db. We can write to it no problem.
I can give you temporary credentials if you want to try it ? There are only images stored on this database.
If you can tell me how to get the imnge into a stream I can write the data manually into the BLOB.
xequte Posted - Jun 05 2024 : 20:42:15
Hi

Are you sure the database is not located in a read-only path?

Nigel
Xequte Software
www.imageen.com
adyble Posted - Jun 05 2024 : 09:25:32
I'd be happy to write the data using insert into, but don;t know how to get at the image
Andy
adyble Posted - Jun 05 2024 : 06:14:20
Thanks for the reply Nigel, That works ok for reading the data. Every time I scan a document using the demo or even compiled demo from you website,
I get access violation on the
fDBBitmap.Write(); line.
The image shows ok, DBrecord remains in dsInsert, so the images is never written to the table.
Andy
xequte Posted - Jun 04 2024 : 18:34:36
Hi

Please see the examples at:

http://www.imageen.com/help/TIEDBBitmap.html

For instance, to make a TImageEnView display the image at the current database position:

// Create DB Aware TImageEnView
procedure TMainForm.FormCreate(Sender: TObject);
begin
  ... Open a database table ...

  fDBBitmap := TIEDBBitmap.create( DataSource1, 'Image', 'Name' );
  ImageEnView1.SetExternalBitmap( fDBBitmap );
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  FreeAndNil( fDBBitmap );
end;



To load an image from the current database position on demand:

MyBMP := TIEDBBitmap.Create();
MyBMP.Read( MyTableImageBlob );
ImageEnView1.Assign( MyBmp );
MyBmp.Free;




Nigel
Xequte Software
www.imageen.com