473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to display image blob from database?

How can I display photo images stored in a SQL Server 2000 databases in a
DataList or DataGrid without having to write the images to files first?

Olav
Nov 18 '05 #1
2 4473
You should be able to stream them by setting the right mime type in your
output.

"Olav Tollefsen" <x@y.com> wrote in message
news:Oj**************@TK2MSFTNGP10.phx.gbl...
How can I display photo images stored in a SQL Server 2000 databases in a
DataList or DataGrid without having to write the images to files first?

Olav

Nov 18 '05 #2
Olav

You need a url that returns the image you want, which you bind to each listitem in your datagrid/datalist, e.g. <img src='<%# "GetImage.aspx?src=" + ID %>'

In this example, GetImage.aspx uses the ID you pass and does the i/o to get a byte array from the blob, then returns it in the output stream as a picture, e.g
response.ContentType = "image/jpeg"
response.BinaryWrite(MyByteArray

The other nice thing about using GetImage is that you can very simply modify the image before you return it to the stream, such as add a description or copyright notice onto the picture, return a thumbnail, etc. In that case, you'd create your bitmap from the blob, modify it however, then do bitmap.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg) to output it to the stream

For a great discussion of this and a lot more, check out Esposito's Programming Microsoft ASP.NET from MS Press (pp. 1036-1044)

hth

Bil

----- Olav Tollefsen wrote: ----

How can I display photo images stored in a SQL Server 2000 databases in
DataList or DataGrid without having to write the images to files first

Ola

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: adam | last post by:
Hi, I have an issue that i just cant seem to figure out hope some one can help. right i am getting people to input the own images directly into a blob within a mysql database. then on the next...
2
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image....
2
by: RedSouljaz | last post by:
Hi, How to display image that was saved in database ms sql server 2000 into picture box. The field type that I use in database is Images I can save to database but cannot show from database. ...
8
by: yoyo | last post by:
Ok, I think I just may be a moron, but where the heck are the Image extenders found? I've look all around, tried all the DB2 cd's I have, are they installed by default somewhere? Which install...
7
by: eholz1 | last post by:
Hello Group, Perhaps you can help me. I have a mysql db, that holds images. Images are encoded using base64_decode/encode, etc. Image data seems fine. I have a view.php page that is supposed...
1
by: rh1200la | last post by:
Hey all. I'm trying to display a BLOB image from SQL Server to a .NET user control. I have found resources on the internet that say create a .aspx page and display at as content type image/gif. ...
0
by: adilzcool | last post by:
Hi All , I am New to this Form i am working on project to consume Java Webservice from PHP (front end). So i need to display an image sent from JWS (WSDL) mode in PHP. I have used diff...
1
by: swethak | last post by:
Hi, I write the code to display images.But it will not display image.And also gives the error like that error : Notice: Undefined index: gim in F:\Facebook\pic_up.php on line 59 plz tell...
11
by: nse111 | last post by:
<?php //header('Content-Type: image/jpeg'); header('Content-Type: text/html'); @mysql_connect("localhost","root","dba") or die("Error"); @mysql_select_db("gallery"); $result =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.