p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Displaying Images On Web pages from database


Message #1 by "amit" <kulamit@p...> on Fri, 7 Jul 2000 14:51:29
This quetion is related to two topics 

1)Databse(Oracle 7.x,8.X) and

2)Asp 



My quetion is, how to save images in database (Oracle) and how to pull it 

from database through asp to show them on web pages.



Well tried hard to get my work done. But couldn't succeed.

Well what I tried is listed below



Step1> First I created one table with two coloumns having data types 

varchar2 for storing names and long raw for storing images.



Step2> Then I wrote little program to store images in database.

Porgram was written in VB6. It's working as follows

First it reads the iamges which could be .gif ir .tif in chunks and then 

it used append it to recordset object of ADO. Then updating it to a 

database.



Step3> It was with database. Now lets go on ASP coding.

It is very simple one. I created connection, recordset and query to pull 

images. Then I specified type if HTML header through 

response.ContentType, I also enabled the buffer.

After that I wrote 

response.BinaryWrite rs.Fields("ColumnName")



What I wrote was a simple code given in every book. But it is not working.



When I execute that page it shows error ICON i.e.



So can anybody please tell me what could be the possible reason.



I want to show all type of images from database like GIF,tif etc



Regards

Amit

kulamit@p...



Message #2 by "Ken Schaefer" <ken.s@a...> on Mon, 10 Jul 2000 12:45:21 +1000
How about you save the images on the hard drive, and store the URL in the

database, and then merge this into the src attribute of the <img> tag?



<img src="<% =objRS("imageURL")%>">



In response to your other question, browsers don't render .tif images

natively. They render GIFs, JPEGs (and later browsers) PNG.



Cheers

Ken

----- Original Message -----

From: "amit" <kulamit@p...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, July 07, 2000 2:51 PM

Subject: [asp_databases] Displaying Images On Web pages from database





> This quetion is related to two topics

> 1)Databse(Oracle 7.x,8.X) and

> 2)Asp

>

> My quetion is, how to save images in database (Oracle) and how to pull it

> from database through asp to show them on web pages.

>

> Well tried hard to get my work done. But couldn't succeed.

> Well what I tried is listed below

>

> Step1> First I created one table with two coloumns having data types

> varchar2 for storing names and long raw for storing images.

>

> Step2> Then I wrote little program to store images in database.

> Porgram was written in VB6. It's working as follows

> First it reads the iamges which could be .gif ir .tif in chunks and then

> it used append it to recordset object of ADO. Then updating it to a

> database.

>

> Step3> It was with database. Now lets go on ASP coding.

> It is very simple one. I created connection, recordset and query to pull

> images. Then I specified type if HTML header through

> response.ContentType, I also enabled the buffer.

> After that I wrote

> response.BinaryWrite rs.Fields("ColumnName")

>

> What I wrote was a simple code given in every book. But it is not working.

>

> When I execute that page it shows error ICON i.e.

>

> So can anybody please tell me what could be the possible reason.

>

> I want to show all type of images from database like GIF,tif etc

>

> Regards

> Amit

> kulamit@p...






  Return to Index