Vive Corp.
 
 
     Displaying images on the web page
 
Services Products Support Downloads Contact Us About Us Site map

Software Development

Since 1991

 
    Displaying images using ASP:          
 
Retrieving image from a database is much easier task if you compare it to uploading. Here is ASP script you can use to get the image from the database and put it on your web page.

ASP page (for SQL Server)

<%@ LANGUAGE="VBSCRIPT" %>

 <%
 if request("name") = "" then Response.End

 ' Clear out the existing HTTP header information
 Response.Expires = 0
 Response.Buffer = TRUE
 Response.Clear

 ' Change the HTTP header to reflect 
 ' that an image is being passed.
 Response.ContentType = "image/gif"

 query = "select Picture from temp_image where File_Name = '" 
 	& Request("name") & "'"
 set Connection = server.createobject("ADODB.Connection")
 Connection.Open "Provider=SQLOLEDB; Data Source=server; 
 Initial Catalog=dbname; User ID=user; Password=password"

 set rsBlob = Server.CreateObject("adodb.recordset")
 rsBlob.Open query, Connection, 2, 3

 if rsBlob.eof then Response.End
 if isnull(rsBlob(0)) then Response.End

 Response.BinaryWrite rsBlob(0)
 rsBlob.Close
 Set rsBlob = Nothing
 Response.End
 %>

To make your web page work with this script you need to insert the following code into your html page:

<IMG SRC="getPicture.asp?name=test.gif">
      Products:

Image2db
dataPro
SqlPro

Download Image2db
Image2db

Displaying images using Perl

 
             
 
Services | Products | Support | Downloads | Contact Us | About Us | Site Map
Copyright 1998-2007 Vive Corp. All rights reserved.