Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Displaying Images From An SQL Database in a WEb Page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Just Me - 02 Sep 2007 19:07 GMT
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
Tom Dacon - 02 Sep 2007 19:39 GMT
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

> Hi,
>
[quoted text clipped - 30 lines]
>
> Thanks
John Mott - 04 Sep 2007 17:50 GMT
You can do this:

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

where imagefetcher.aspx 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

> Hi,
>
[quoted text clipped - 30 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.