473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying Images From An SQL Database in a WEb Page

Hi,

Im playing with this concept at the moment and was hoping to design an image
retreival system which would allow me to place images into the web page "
Where I want them", but draw them from the SQL Database.

I know how to get the image from the sql server, and I know one way of
writing the image to the page using BinaryWrite method of the reponse
object.

However, once you use BinaryWrite, it seems to obliterate eveything else.
What I need is to be able to render the page as I would normally do, but not
rely on images stored as files on a web server, or at least to generate the
URI' to them on the fly somehow. It seems a shame that when you getrecords
which you need to display pictures from that you have to go get them all
again jsut for the picture. An exampleof this would be a personell record, I
want to display the details about the person along with a pic, the pic is
retreived, but I can render the pic.

I might add here, that I am creating html content inside a aspx form by
using an htmlwriter object , this allows me to publish articles directly
fromt he database using custom formatting.

However, I am aware that the <img tag's src attribute seems to be limited to
either a URL which is a real URI or a more limited data:image//gid;base64 in
line type thing.

I think the asnwer is that you realistically cant do this in-line, and need
to store the images on disk.

Any responses which can confirm this or offer an alternative would be most
useful.
Thanks
Sep 2 '07 #1
2 1765
The Personal Web Site Starter Kit would be a good place to look at one way
to do it. Search for that string on MSDN or the Microsoft site. Download it
and install it and bring it up in Visual Studio and look around. It has a
photo albums section that takes the images from a Sql Server Express
database.

Tom Dacon
Dacon Software Consulting

"Just Me" <news.microsoft .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi,

Im playing with this concept at the moment and was hoping to design an
image retreival system which would allow me to place images into the web
page " Where I want them", but draw them from the SQL Database.

I know how to get the image from the sql server, and I know one way of
writing the image to the page using BinaryWrite method of the reponse
object.

However, once you use BinaryWrite, it seems to obliterate eveything else.
What I need is to be able to render the page as I would normally do, but
not rely on images stored as files on a web server, or at least to
generate the URI' to them on the fly somehow. It seems a shame that when
you getrecords which you need to display pictures from that you have to go
get them all again jsut for the picture. An exampleof this would be a
personell record, I want to display the details about the person along
with a pic, the pic is retreived, but I can render the pic.

I might add here, that I am creating html content inside a aspx form by
using an htmlwriter object , this allows me to publish articles directly
fromt he database using custom formatting.

However, I am aware that the <img tag's src attribute seems to be limited
to either a URL which is a real URI or a more limited
data:image//gid;base64 in line type thing.

I think the asnwer is that you realistically cant do this in-line, and
need to store the images on disk.

Any responses which can confirm this or offer an alternative would be most
useful.
Thanks

Sep 2 '07 #2

You can do this:

<img src="http://mysite/imagefetcher.as px?ID=3434"/>

where imagefetcher.as px takes an ID of an image and renders it. Remember,
its the browser that calls back in to get the image data, you don't have to
generate it at the same time that you are generating the page.

i would also not store actual images in a database -- the file system is a
wonderful mechanism for storing files. of course, keeping a control record
for the image (with the filename as part of it) is a good idea so it can be
joined appropriately.

john

"Just Me" <news.microsoft .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi,

Im playing with this concept at the moment and was hoping to design an
image retreival system which would allow me to place images into the web
page " Where I want them", but draw them from the SQL Database.

I know how to get the image from the sql server, and I know one way of
writing the image to the page using BinaryWrite method of the reponse
object.

However, once you use BinaryWrite, it seems to obliterate eveything else.
What I need is to be able to render the page as I would normally do, but
not rely on images stored as files on a web server, or at least to
generate the URI' to them on the fly somehow. It seems a shame that when
you getrecords which you need to display pictures from that you have to go
get them all again jsut for the picture. An exampleof this would be a
personell record, I want to display the details about the person along
with a pic, the pic is retreived, but I can render the pic.

I might add here, that I am creating html content inside a aspx form by
using an htmlwriter object , this allows me to publish articles directly
fromt he database using custom formatting.

However, I am aware that the <img tag's src attribute seems to be limited
to either a URL which is a real URI or a more limited
data:image//gid;base64 in line type thing.

I think the asnwer is that you realistically cant do this in-line, and
need to store the images on disk.

Any responses which can confirm this or offer an alternative would be most
useful.
Thanks

Sep 4 '07 #3

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

Similar topics

7
2337
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed? What is the best way to do this?
3
1353
by: Irfan Akram | last post by:
Hi Guys, I am having problems displaying an image from the database, that alreday has been uoploaded successfully. The image loads in correctly, but by default it is displayed on the whole page. I want it to bde displayed on some part of the page. I was able to do that if I used img.ImageUrl, for images stored on my hard drive, but I want to view it from anywhere my site is sccessed, hence I decided to get it loaded directly from...
3
2365
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an HMTL page without having to save them to the server and create a URL to the virtual directory? FYI: I currently am doing this with just single images. I do a Response.BinaryWrite(byte) to display the one image. The advantage is that I never...
1
1717
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this do to server/site performance? The other is to copy the photo at time of upload and create a thumbnail then, have two separate images, therefor when displaying its just pulling the actual image. What do you think??
3
5828
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good for multiple page faxes. I have not been able to locate an example to load in the browser or how to handle multiple image in the one column. 1) Ideally it would be nice to display back in the browser since some may be multiple images. I am not...
8
1773
by: Lloyd Sheen | last post by:
I have a list of JPG's which are found in a SQL Server database. When the page selects a certain piece of data it will refer to the file system (resident on IIS server with a virtual directory) and files contained within a certain folder. I have been trying for quite a while to set the ImageURL of an image control to the correct information. I have googled till my mind hurts but can find nothing to help. I have even tried to copy the...
10
5762
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the images) of the gridview come from a single table/datasource. Here is my situation. In my web application, I need to display customer bills info in a gridview. Customer names and contact info are from the Customer table.
4
2679
by: redpears007 | last post by:
Hi Again, Throwing this one out to you again as i am not getting anywhere and can find little to no information out there. I am currently displaying images (Jpegs) in access via the routine set up in the article http://support.microsoft.com/kb/285820/en-us. It works fine if the image is under 1000x1000 pixels. It is set up so the user can double click to open the image in its host application.
5
2944
by: asharda | last post by:
Hi, I have an ASP.Net application with the back-end as VB.Net. I have a combo control and on the selection changed event of the combo control I need to get the selected image from the database and display it on a Image control on the asp.net page. I get the image from the db as a byte array. Can anyone please help, as to how to show the image on the page in that image control?
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
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
9476
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...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8210
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...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
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...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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

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.