473,725 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1498
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.Conten tType property to "image/jpg" and streams the image
to the client in the Response.Output Stream. 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.c om...

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.Conten tType property to "image/jpg" and streams the image
to the client in the Response.Output Stream. 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
1600
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 82 pixels it gets stretched and misformed. How do I solve this? At first I planned to write a vb-dll that checks the image's height but since the image come's as a BLOD from sql-server tat is a no-go.
7
2340
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 - 1) ) when I look at the value of FM_ITEMS in my debug log it is 32.
2
6650
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 instances. I have set it up to use binary serialization to a single file, which works well. However, I have learned that changes to my classes break the old serialized files. While my object model is pretty stable, I am concerned that using binary...
3
3636
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 application, while I am doing for web. I can only find Image from web forms control and HTML control. This may be the root cause of my problem. For read button, I converted his VB to the C#. But the compiler complains:
2
3179
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 problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
2
3751
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. At least when I execute the following code, I get some significant network traffic. When I check the database with query analyzer, I see 4 Hex Chars in the image colum. Like 0xe0 etc.
1
9643
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
53
4743
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, and .Net2005 code. I'm developing in vb.net 2005. This test sub just reads an input text file, writing out records to another text file, eliminating records that have a '99' in them (it is similar to a CSV file). Some of my concerns are:
2
7380
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 database and I cannot get the image to work. The columns in the database are of type text. Here is one of the images text (in full) in the database (I hope you can see it):
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.