1

Simple question: how to display retrieved ravendb attachment image in winforms pictureBox.

Attachment is retrieved as

Raven.Abstractions.Data.Attachment attachment =
                        _store.DatabaseCommands.GetAttachment("upload/"+ 9999);

update

Image is save with put attachment like this

 _Store.DatabaseCommands.PutAttachment("upload/" + attachId, null, ms,
                                            new RavenJObject
                                                {
                                                   { "Content-Type", "image/jpeg" }

                                                });

ms is memory stream

user2783193
  • 992
  • 1
  • 12
  • 37

1 Answers1

2

You need to retrieve the attachment memory stream from the Attachment object:

pictureBox1.Image = Image.FromStream(attachment.Data());

See more in the docs

wal
  • 17,409
  • 8
  • 74
  • 109