How to process images in ASP

Source: Internet
Author: User
Tags table name
In asp Programming, images are often used. You have talked a lot about how to process an image from a database. You can refer to the following code: assume that you have a database named pubs, there is a table named pub_info in the database, and there is a logo blob column in the table. We can find photos of people whose pub_id is 0736.
File &: showimg. asp
***************************************
<% @ Language = "vb" %>
<%
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"
Set cn = server. createobject ("adodb. connection ")
The following open line assumes you have set up a system datasource
By the name of mydsn.
Cn. open "dsn = mydsn; uid = sa; pwd =; database = pubs"
Set rs = cn.exe cute ("select logo from pub_info where pub_id = 0736 ")
Response. binarywrite rs ("logo ")
Response. end
%>
**************************************** *
Execute this asp file to view the images in your database.
However, it may be difficult to process text and images simultaneously :-(
For example, for enterprise personnel management, backend databases can use sybase or SQL server. (I am using SQL server here) when you need to use browse/server in the enterprise, that is, to view employee personal information in a browser, that is to say, to process text information, we also need to use the image technology.
The problem is that when you display text information, the content in the html head is "text/html ", the displayed image must be content = "image/gif" or content = "image/jpeg". Therefore, you cannot process text information and images using only one asp file. The solution is to process images using a separate asp file, then, the asp file is called in the asp file that processes text information.
Here we will introduce you to my solution. I hope you can discuss it together:
Environment: winnt4.0 SQL server iis3.0
Database name: rsda
Table name: rsda_table
Objective: to obtain the information of the person with id = 00001 from rsda_table, including name, age, and photo
Step 1: Create a query table ticket rsda.htm:
**********************************
<Html>
<Head>
</Head>
<Body>
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.