SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 25th, 2003, 09:50 AM
britpopped britpopped is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 2 britpopped User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
using jpegs in Access

I'm having difficulty displaying an jpeg (or gif) on a website, getting it from a table in Access.

In my HTML i'm setting the image tag to retrieve from the 'pic' field in my database, have no problem with any connections, I'm retrieving text on the same page fine. The 'pic' field is an OLE object data type. When I select the jpeg(or gif) I want in an entry, it calls it a "Package".

I've tried a couple of books and all the help files, but can't find anything about it all. Surely it's pretty simple when you're creating dynamic page sites to retrieve images as well as text in Access??

Help appreciated,

DANIEL

Reply With Quote
  #2  
Old February 25th, 2003, 11:34 PM
yassoor's Avatar
yassoor yassoor is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada - Egypt
Posts: 60 yassoor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I ran into this problem before.
I will try to make this as simple and understandable as I can.
If there is an easier way anyone knows, please let all of us know.

When I had to do it I used ASP. so I will keep going as if it is going to be developed in asp.

A regular asp page that has html tags on is of content type "text/html" ... Response.ContentType

When you retrieve an image from the database , you are actually recieving the encoded binary file. A regular response.write(recordset.Fields("ImageField")), will not do it.

To write the image for the browser to read the content type should be set to "image/jpeg" or "image/gif"


Now you cannot switch from content type text to content type image on the same page.

Work around:
Create a small asp page: Lets call it imageViewer.asp
Code:
Set rs = Server.CreateObject("ADODB.RecordSet")
Dim ID
ID = Trim ( Request("ID") & "")

Check on ID is valid ..... ID is the ID of the record that will have the image field.

Set rs = Database.Execute("SELECT * FROM tbl_Images ID = " & ID )
			
If NOT (rs.EOF AND rs.BOF) Then
		
	Response.ContentType = "image/jpeg" 
	Response.BinaryWrite rs("Image Field Name")
	rs.Close
			
End If

Set rs = Nothing



Now from your regular asp page
the imag tag will look something like this

<IMG src = "images/ImageViewer.asp?ID=192837">

=======================

Another problem I have faced and this cost me alot of time.
"The binary code ACCESS will translate the image to" is different if the OLE object was imported "from inside ACCESS" than if it was "uploaded to the database using a webpage".

This only worked for me when the images where uploaded using an asp page.

I hope this is of any help, and please if you have any questions, just ask.
__________________
I hope this is of any help to anyone.

Yassoor
http://www.WebsitesCreation.ca

Last edited by yassoor : February 26th, 2003 at 12:02 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > using jpegs in Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway