473,387 Members | 1,374 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,387 software developers and data experts.

Advice needed: reading image (binary) data from a db, to be placed in an Image control ??


Hello,

I'm wondering if anyone can help me out here?

I want to be able to browse records in a database where one of the
fields contains an image.

I think I might have to extract the image to a byte array, write it to
a temp file then refer to the temp file as the URL source for the
Image control.

I've been trying this method, but I'm stuck on a couple of points.

1. The ImageURL property is not being written to the page when it gets
to the browser, and

2. I'm having trouble writing the byte array to a file on disk.

Am I going about this the wrong way?
-Denise
Nov 18 '05 #1
2 1484
You don't need to write a byte array or anything else to a disk. Just create
an ASPX page that grabs the binary data, converts it to an in-memory Bitmap,
sets the Response.ContentType property to "image/jpg" and streams the image
to the client in the Response.OutputStream. Then the URL of this ASPX page
can be the source of an HTML Image tag, as in:

<img src="image.aspx">

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Denise Smith" <ni*******@mail.dk> wrote in message
news:ag********************************@4ax.com...

Hello,

I'm wondering if anyone can help me out here?

I want to be able to browse records in a database where one of the
fields contains an image.

I think I might have to extract the image to a byte array, write it to
a temp file then refer to the temp file as the URL source for the
Image control.

I've been trying this method, but I'm stuck on a couple of points.

1. The ImageURL property is not being written to the page when it gets
to the browser, and

2. I'm having trouble writing the byte array to a file on disk.

Am I going about this the wrong way?
-Denise

Nov 18 '05 #2

Thanks for the help. I got it to work!
On Thu, 20 Nov 2003 14:33:20 -0500, "Kevin Spencer"
<ke***@takempis.com> wrote:
You don't need to write a byte array or anything else to a disk. Just create
an ASPX page that grabs the binary data, converts it to an in-memory Bitmap,
sets the Response.ContentType property to "image/jpg" and streams the image
to the client in the Response.OutputStream. Then the URL of this ASPX page
can be the source of an HTML Image tag, as in:

<img src="image.aspx">


Nov 18 '05 #3

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

Similar topics

2
by: Roland Wolters | last post by:
Hi, I need to show an image in the header of an asp page. If the image's width is greater then 82 pixels, the header gets mis-formed. If I specify the height for the image and it is smaller then...
7
by: John Smith | last post by:
Hi All, Sorry if I am calling expert's advice on such a simple thing. I am reading a c++ code but do not understand what this means? #define DM_ITEMS 6 #define FM_ITEMS ( 1 << (DM_ITEMS -...
2
by: Dave Veeneman | last post by:
I'm working on a project where I have to persist data to a file, rather than to a database. Basically, I need to save the state of several classes, each of which will have a couple of dozen...
3
by: dale zhang | last post by:
Hi, I am trying to read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp The article author is using PictureBox for windows...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
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....
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
2
by: Ed | last post by:
Hope someone can help me out... I have been tasked to read some image data from an sql database and save the files to flat files. OK, sounds easy as I'v used BLOBs before. But this is an old...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.