If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > View images stored in Access

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-25-03, 17:50
farzinm farzinm is offline
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 18
Question View images stored in Access

Hi
I am trying to view the images stored in my Access DB, as an OLE Object, using ASP
I tried
Response.binarywrite objDB("Images")
but it didnt show the image stored in the db
Any clues?
Thanks
Reply With Quote
  #2 (permalink)  
Old 04-06-03, 04:22
kaeldowdy kaeldowdy is offline
Member
 
Join Date: Apr 2003
Location: Evansville, Indiana
Posts: 75
Lightbulb

You are very close. You have to use the .ContentType property in conjunction with the BinaryWrite method when outputting images...
Code:
' set the ContentType property
Response.ContentType = "image/gif"

' send the binary data to the webbrowser
Response.BinaryWrite (rs("NameOfImageField"))
HTH!

Kael
Reply With Quote
  #3 (permalink)  
Old 04-10-03, 16:27
farzinm farzinm is offline
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 18
Thanks for replying
Heres my code

<%@ Language=VBScript %>
<%Response.ContentType = "image/gif"%>
<HTML>
<BODY>
<%
set conn=Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("test.mdb")
objRS.Open "select * from test",conn
Response.binarywrite objRS("pict")
objRS.Close
set objRS=nothing
conn.Close
set conn=nothing
%>
</BODY>
</HTML>
This time it showed some weird characters as output.
Any suggestions?
Thanks
Reply With Quote
  #4 (permalink)  
Old 04-10-03, 16:46
dbsaxena dbsaxena is offline
Registered User
 
Join Date: Apr 2003
Location: uk
Posts: 3
Exclamation

Hi,

I suspect that you are confusing a few things. Does your database named "test" has a table named "test" in it? Server.Mappath should refer to a directory identified in your web server.

If the above is satisfied than just to be sure, try to display another field (text preferably) from the fetched table.
Reply With Quote
  #5 (permalink)  
Old 04-10-03, 16:55
farzinm farzinm is offline
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 18
I realise I sound confusing but I do have a test.mdb with a "test" table. And I can display another field from the table which is text. Could it be the datatype in the db thats causing the problem?
I have pict column with an "OLE Object" datatype.
To add a picture to the column
I select Insert--> Object
That shows a pop up.
Select option "Create From File option" and browse to select a gif file.
Am I right? Is there any other way of adding pictures to the db?
Reply With Quote
  #6 (permalink)  
Old 06-13-03, 00:33
oddessy oddessy is offline
Registered User
 
Join Date: Aug 2002
Posts: 3
Post Same type of problem.

I have gotten this to work and to display the images if they are posted to the database as a BLOB.

I have gotten this far by using ASPUpload.

I do thought have a very large database of images that have been drag and droped into an MS Access form and was told that they are stored in the database as OLE Objects.

I am trying to get an ASP Page to allow me to display and download these from the database.
Reply With Quote
  #7 (permalink)  
Old 06-13-03, 10:10
farzinm farzinm is offline
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 18
Re: Same type of problem.

I ended up doing it this way
http://www.sagas.net/asp/show.aspx?abcd=93
works fine for me.

Quote:
Originally posted by oddessy
I have gotten this to work and to display the images if they are posted to the database as a BLOB.

I have gotten this far by using ASPUpload.

I do thought have a very large database of images that have been drag and droped into an MS Access form and was told that they are stored in the database as OLE Objects.

I am trying to get an ASP Page to allow me to display and download these from the database.
Reply With Quote
  #8 (permalink)  
Old 06-13-03, 23:47
oddessy oddessy is offline
Registered User
 
Join Date: Aug 2002
Posts: 3
Drag and drop function

Thanks farzinm

I am currently looking at ASPUpload and XUpload for a drag and drop upload option. If anyone has any other options would love to hear and check them out.

I also have the problem of all the images that are currently in MS Access 2000 that were drag and droped as OLE Objects. Over 50,000 documents. I need to convert them to BLOB's and keep all of the data that is in the same record with them so that I can link and display them on the web.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On