Problems with displaying photos

O

orton wisegarver

I have a database that was created in Access with a member
roster and a photo --

photo are in their own field, (OLE Object) and are linked
to the directory that the photos are stored in. Everything
works in Access just fine. Have a report that displays
member roster data and their photo.

Uploaded database to webserver, created DSN and connection
using FrontPage 2002 DRW.

Created ASP results page without pictures, works
perfectly. Created new results page, including the photo
field.. followed the instruction to delete existing field
code, insert new picture, delete path, insert field info
and edited path statement to proper pointing at picture
files...

when I open the results page I get part of the first
record data, and the photo field has the following error
message:

Microsoft VBScript runtime error '800a0006'
Overflow
/db/results2.asp, line 226

line 226 is the field code - <img border="1" src="<%
=images/MemberPics/FP_FieldLink(fp_rs,"Photo")%>"
width="70" height="100">

I have looked high and low for a solution, no-luck.

Anyone have experience with this ??

Regards,

Orton Wiegarver
 
M

MD WebsUnlimited.com

Hi Orton,

Working with images in an Access database is not trival and is not
recommended. Move your images to a folder in the web then use links in the
database to point to the image.
 
O

ortonw

Hi Mike ~
Trivial or not, it is supposed to work. To make sure that
I have described the problem correctly, let me enumerate.
Field for photos is datatype "OLE Ojbect" which is correct
to us a photo in Access ~ when the photo is inserted in
Access, it is "linked" as well, and there is a separate
directory for all the member photos under the
root ..\images\memberpics\photo1, photo2, etc..

As I mentioned this works beautifully when I'm running
Access on my local workstation. I FTP'd the Database and
the directories to the website. Then I used Frontpage 2002
and the DRW to create a "Results" page, setting up the DSN
and the connections. The first results page did not
include the photos, and it works as well as the locally
hosted Access results page. I then created another results
page, but this one with the photo field included. Per the
DRW instructions, I deleted the link in the results form
field for photo, inserted a photo from the hosted
directories with the photos, opened the photo properties,
opened paramters, deleted the displayed path, and inserted
the "field" for photo, which then inserted the following
code in the web page - <img border="1" src="<%
=images/MemberPics/FP_FieldLink(fp_rs,"Photo")%>"
width="70" height="100">

When I try to display the page in my browser I get the
Microsoft VBScript runtime error '800a0006'
Overflow /db/results2.asp, line 226 --- line 226 is
the code that I noted above.

So hopefully from this you can better understand my
problem. If you don't know how to fix it, then hopefully
someone else reading this has had to solve this problem
and can help me.

Regards,

Orton
 
J

Jim Buyens

As you've discovered, you can't display photos stored
within an Access database the way you can display text or
numbers. This is because a Web page can't physically
contain pictures. A Web page can only contain
<img src=... > tags that point to picture files.

The challenge, then, it to create a URL you can put inside
an <img src=... > tag. To display pictures stored inside
an Access database, that URL needs to point to a server-
side program that retrieves the Access record, retrieves
the picture data, converts it to a format that the browser
can deal with, and then transmits the converted picture
bits.

So, for example, your DRW page will need to use a custom
query like:

SELECT '<img src=bitmap.asp?id=' & [id] & '>' as
imgtag, ...

where id is a field that uniquely identifies each record.
You'll also need to right-click the imgtag field in the
finished Database Results Region, choose Database Column
Value Properties, and select Column Value Contains HTML.

Now, of course, you need to create the bitmap.asp. For
instructions on that task, browse:

MS KB article 175261
Retrieve Bitmap from Access and Display It in Web Page
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;175261

You'll need Visual Basic 6.0 to create the ActiveX control
this article explains, and you'll also need code that
receives the id= query string value and sends it to the
ActiveX control.

When you're done with all this, you'll need to get your
host to register your custom ActiveX control on the Web
server. Also, you should be aware that techniques in MSKB
article 175261 send the picture to the browser in .bmp
format, which is very wasteful of bandwidth and not always
supported on systems other than Windows.

If all this seems terribly complex for just displaying a
picture, I have to agree, so do the overwhelming majority
of Web designers. The preferable method by far is to store
the picture file name in the database, and then use SQL
code like

SELECT '<img src=' & [picfilename] & '>' as imgtag

to display the picture files.

If you *must* store the picture bits in the database for
some reason, chapter 10 of Microsoft Office FrontPage 2003
Inside Out describes a working example. See pp. 280-282.
The companion CD contains sample code for a working
example.

A similar example, complete with code on the CD, appears
in Microsoft FrontPage Version 2002 Inside Out. Refer to
the sidebar titled Pictures by Programming on pp. 343-345.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
O

Orton Wisegarver

Thank You! ~ the method is irrelevant, it is the results
that are important .. your suggestion of storing the link
sounds like the best solution. A couple of question about
linking... can the path be relative ? do I use an "href"
tag to identify the link in the Access field ?

Thanks,

Orton Wisegarver
-----Original Message-----
As you've discovered, you can't display photos stored
within an Access database the way you can display text or
numbers. This is because a Web page can't physically
contain pictures. A Web page can only contain
<img src=... > tags that point to picture files.

The challenge, then, it to create a URL you can put inside
an <img src=... > tag. To display pictures stored inside
an Access database, that URL needs to point to a server-
side program that retrieves the Access record, retrieves
the picture data, converts it to a format that the browser
can deal with, and then transmits the converted picture
bits.

So, for example, your DRW page will need to use a custom
query like:

SELECT '<img src=bitmap.asp?id=' & [id] & '>' as
imgtag, ...

where id is a field that uniquely identifies each record.
You'll also need to right-click the imgtag field in the
finished Database Results Region, choose Database Column
Value Properties, and select Column Value Contains HTML.

Now, of course, you need to create the bitmap.asp. For
instructions on that task, browse:

MS KB article 175261
Retrieve Bitmap from Access and Display It in Web Page
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;175261

You'll need Visual Basic 6.0 to create the ActiveX control
this article explains, and you'll also need code that
receives the id= query string value and sends it to the
ActiveX control.

When you're done with all this, you'll need to get your
host to register your custom ActiveX control on the Web
server. Also, you should be aware that techniques in MSKB
article 175261 send the picture to the browser in .bmp
format, which is very wasteful of bandwidth and not always
supported on systems other than Windows.

If all this seems terribly complex for just displaying a
picture, I have to agree, so do the overwhelming majority
of Web designers. The preferable method by far is to store
the picture file name in the database, and then use SQL
code like

SELECT '<img src=' & [picfilename] & '>' as imgtag

to display the picture files.

If you *must* store the picture bits in the database for
some reason, chapter 10 of Microsoft Office FrontPage 2003
Inside Out describes a working example. See pp. 280-282.
The companion CD contains sample code for a working
example.

A similar example, complete with code on the CD, appears
in Microsoft FrontPage Version 2002 Inside Out. Refer to
the sidebar titled Pictures by Programming on pp. 343-345.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------

-----Original Message-----
I have a database that was created in Access with a
member roster and a photo --

photo are in their own field, (OLE Object) and are linked
to the directory that the photos are stored in.
Everything works in Access just fine. Have a report that
displays member roster data and their photo.

Uploaded database to webserver, created DSN and
connection using FrontPage 2002 DRW.

Created ASP results page without pictures, works
perfectly. Created new results page, including the photo
field.. followed the instruction to delete existing field
code, insert new picture, delete path, insert field info
and edited path statement to proper pointing at picture
files...

when I open the results page I get part of the first
record data, and the photo field has the following error
message:

Microsoft VBScript runtime error '800a0006'
Overflow
/db/results2.asp, line 226

line 226 is the field code - <img border="1" src="<%
=images/MemberPics/FP_FieldLink(fp_rs,"Photo")%>"
width="70" height="100">

I have looked high and low for a solution, no-luck.

Anyone have experience with this ??


.
 
J

Jim Buyens

Orton Wisegarver said:
Thank You! ~ the method is irrelevant, it is the results
that are important .. your suggestion of storing the link
sounds like the best solution. A couple of question about
linking... can the path be relative ? do I use an "href"
tag to identify the link in the Access field ?

Yes, a relative path is fine, and in fact preferred.

No, you don't use <a href=...> tag to display a picture. You need
to use an <img src=...> tag, as shown below for a custom query.

SELECT '<img src=' & [picfilename] & '>' as imgtag, ...

Note that you store just the picture filename, such as orton.jpg,
in the database. This is because the path to the picture folder
will likely vary from page to page. For example, you might have
to code either of these forms, or others, depending on the relative
location
of the Web page and the pictures:

SELECT '<img src=' & [picfilename] & '>' as imgtag, ...

SELECT '<img src=' & chr(34) & '../images/' & [picfilename] & chr(34)
& '>' as imgtag, ...

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
C

chrystal

Hi Orton,
Remember me? It's Chrystal..not in Pensacola anymore living up in
cabin in the ozark mountains...email me at (e-mail address removed)

Try making your picture smaller and repeating the steps you too
because it sounds like your overflow error may be because the memory i
is taking up is too big.

Chrystal


orton said:
*I have a database that was created in Access with a member
roster and a photo --

photo are in their own field, (OLE Object) and are linked
to the directory that the photos are stored in. Everything
works in Access just fine. Have a report that displays
member roster data and their photo.

Uploaded database to webserver, created DSN and connection
using FrontPage 2002 DRW.

Created ASP results page without pictures, works
perfectly. Created new results page, including the photo
field.. followed the instruction to delete existing field
code, insert new picture, delete path, insert field info
and edited path statement to proper pointing at picture
files...

when I open the results page I get part of the first
record data, and the photo field has the following error
message:

Microsoft VBScript runtime error '800a0006'
Overflow
/db/results2.asp, line 226

line 226 is the field code - <img border="1" src="<%
=images/MemberPics/FP_FieldLink(fp_rs,"Photo")%>"
width="70" height="100">

I have looked high and low for a solution, no-luck.

Anyone have experience with this ??

Regards,

Orton Wiegarver


-
chrysta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top