Convert BLOB to Jpg using C #

I am currently developing a web application that retrieves data from a database in place. Database developers have developed some web services that I can call and send / receive data to and from the database.

When I want to display an image, the method returns an image in BLOB format. My question is: what is the best way to convert BLOB to .jpg or .bmp so that I can display the image correctly? If someone can point me in the right direction, that would be great!

Cheers, Tristan

+3
source share
3 answers

You can create a common handler (ashx file) and return an array of bytes.

, url http://www.example.com/GetImage.ashx?imageId=1 , 1.

, .., . mime jpg, png , .

stackoverflow : MemoryStream asp: ?

+3

, BLOB. . , (libmagic ), , .

0

byte [] array and mimetype are keywords :)

0
source

Source: https://habr.com/ru/post/1738392/


All Articles