| | | ASP Image Database Publishing This sample illustrates how to publish an image database on an IIS or PWS web-server. Images are stored in database tables and administered using Access forms.
You could use this approach either to update the live database (if the web server is locally accessible), or update the database locally then upload it to the web server. Alternatively you could generate static html and image files from an offline version of the website - these could then be uploaded to any kind of web server.
Note that publishing images directly from an Access database is generally not recommended for highly loaded systems unless suitable steps (eg caching systems) are used to mitigate the load.
| Screenshots
|
| System Requirements
DBPix Image Control version 2.0. IIS 4.0 or later or PWS Any web browser Access 2000 or later (for administration forms) Suitable database connection such as MDAC/OLE DB drivers or ODBC (MDAC 2.6 or later with OLE DB 4.0 recommended)
Installation
Unzip the file into a new folder on your IIS web server ensuring that the directory structure is reproduced. Ensure that the IIS configuration allows script access to the top-level folder. If your system supports the "Microsoft.Jet.OLEDB.4.0" provider (as installed by MDAC 2.5 and later) then no further configuration is necessary. Otherwise edit the 'config.asp' file located in the top-level folder and update the connection string as indicated in the file. If necessary you may need to set up an ODBC connection. For more information on configuring connection strings there are several excellent resources listed on the links page at www.ammara.com
Walkthrough
Connect to your web-server at the url corresponding to where you installed the files. You'll see a simple list showing the thumbnail image for each record along with some textual data. Click a thumbnail to see the 'detail' view
Open the asppub2k.mdb databse, open the 'Photos' form and scroll through the records viewing the associated images. Scroll to a new record and right-click on the larger image control to add an image from the filesystem. Close the form, then refresh the browser to review the new entry.
Technical Overview
The Start Page (default.asp) is generated by querying the 'tPhotos' table. For each row that the query returns, a row containing an HTML image tag is added to an HTML table. Instead of referring to a specific image file it points at another asp script, passing the Id of the required image as a parameter. Additionally, the image tag is completed with the dimensions of the image which were stored in the database. When the browser requests the image from the webserver the request is handled by the getimage.asp script which retrieves the image from the database and returns it to the browser just as if the browser had requested a regular image file.
The image tags are generated by the following ASP Code: <img src="getimage.asp?field=Thumb&imgid=<%=oRS("Id")%>" width="<%=oRS("Width")%>" height="<%=oRS("Height")%>">
which is seen by the browser as: <img src="getimage.asp?field=Thumb&imgid=21" width="140" height="90">
See the links to the source code above to examine the files in more detail.
| Files & Code
| File / module | | Description | | |
| default.asp | | Main sample page which displays images from the database | | View Code | detail.asp | | Displays the main (detail) image for a specific record from the database | | View Code | getimage.asp | | Server script to return the images from the database | | View Code | adovbs.inc | | ADO constants include file for VBScript | | View Code | config.inc | | Configuration file containing connection strings | | View Code | readme.htm | | This file | | | viewcode.asp | | Utility script to view source code | | | simpasp97.mdb | | Database containing the images and administration forms | | |
|
| | 000000000000000000000000000000000000000000000000000000000000000000000 | |
|
|
|