Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can I use ASP to write a image?

Posted on 1998-09-19
4
Medium Priority
?
217 Views
Last Modified: 2013-12-25
I used a lot response.write to write text into HTML file. Can I and how can I write a image into the html file. I found that there is a function named response.binarywrite, but don't know how to use it? I would be very appretiate if anybody could give me an advice.
0
Comment
Question by:yysun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 400 total points
ID: 1855158
You can do more or less what you want, but it's probably different from what you think.

In HTML the code for an image is made by a <img src="image.gif">

What you can do is use: <img src="ShowImage.asp?ID=5">. To do this you need a ShowImage.asp, which sends the binary data of an image.

Example code of ShowImage.asp:
================
<%
Response.ContentType = "image/GIF"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=Images"

strSQL = "SELECT * FROM Images WHERE ID=" & Request.Querystring("ID")
Set RSImage = Conn.Execute(strSQL)

Response.Binarywrite RSImage("Image")

%>
========================
Which will show an image that is stored in a database.


Another example:
=========================
<%
Response.ContentType = "image/GIF"
%>
<!--#INCLUDE FILE="image.gif"-->
========================
Which will read aa image file from the server

0
 

Author Comment

by:yysun
ID: 1855159
Thank you sybe.

In the first Example, can you tell me what is DBMS and what is the filed type of "image"?

Can I first write some text then an image, e.g. Add
Response.write "hello"
before
Response.ContentType = "image/GIF"

finally, how can I develop an OLE Automation server to create the image?

0
 
LVL 28

Expert Comment

by:sybe
ID: 1855160
1. I don't know what you mean by DBMS, I know it only from a property of the connection object, and it tells you what kind of database is in use.

2. The file type of the image does not really matter. Browsers will display a JPG ok, even if it is told that it's a GIF.

3. No, when you add any code before "Response.ContentType = .." then you get an error message.
If you write some output after ContentType = image/GIF, then the browser thinks that that text is part of the binary code of the image, and the browser is not able to display the image well (it shows a broken image).

4. You should NOT read the images into the database using OLE, even if you use a OLE-filed type. If you use OLE to get the image into the database, ACCESS will convert it to BMP and at the same time save the original format. So this will really destroy the binary code you want to have.
What you need is to use the AppendChunk function of VBA to read the image into the OLE-field as binary code.



0
 

Author Comment

by:yysun
ID: 1855161
I mean what type of database to use, SQL server or access or anything else.

And what is the FIELD type for the image data? (sorry for previous wrong type filed type)?

Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question