Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting images in an access database to be viewed in a cf template

Status
Not open for further replies.

JamesMcCormick

Technical User
Joined
Mar 27, 2002
Messages
1
Location
IE
Hey there,
I'm in a bit of a fix - I need to know how to insert or link an image to an access database in order that the image can be displayed through my browser - when I bring up the cold fusion template files.
I've seen it done, but the tutor has gone away for Easter and my project is due on Friday.
My images are stored in the images folder in and the access db is in a directory of
I'd appreciate any help.
JamesMc
 
That doesn't make sense! If the images are on the disk (in your images folder), why do you need to "insert or link them to an Access database" (and what do you mean by "link"?) To insert an image into your web page you write:

<img src=&quot;url_to_image_file&quot;>

which in your case might be &quot;<img src=&quot;/images/something.gif>&quot;.

If you have stored the images in your database, they must be extracted and saved to disk so that you can use the code above. This is the only way I know to display an image that is stored in a database if the browser is Netscape. If the browser is IE, you have an additional way (I haven't done this): my book says that IE supports an attribute of the <IMG> tag called &quot;DATAFLD&quot; and described as being &quot;the column name from the data source object that supplies the bound data to set the SRC of the <IMG> element&quot;. What does YOUR book say? I don't know IE very well so you'll have to figure out what a &quot;data source object&quot; is in IE. I would start by studying the document object model in IE. It's probably in there.
 
WWebSpider,

I looked at your the URL that you mentioned. All that talke about is using information extracted from the database that is ABOUT the image.

JamesMcCormick , is THAT what you're after?
 
hmmm...
I have users upload images
Use #cffil.param#, param in this case being serverfile

inset that file name into the database for the corrosponding users info. when the users page is called up (by anyone) the data is then put into the image path

img src path/blah/images/#query.imagename#

store the filename in the database, keep the images wherever they will be accessible to the users. also in the database is other information identifying where to use the images, in my case, a users car ID.

maybe that helps?

Kevin

...DOWNLOAD THE CFML REFERENCE...

 
Is your question &quot;How do I get an image stored in a database to be displayed on the page?&quot;

My answer would be to not store the images (or image files) in the database, but keep the filenames in the database instead. That way, when you want to reference the images in your template, you query the database for the image filenames you want:
Code:
SELECT ImageFileName FROM MyDB WHERE (selection criteria);
and then output the results in your template however you want:
Code:
<cfoutput>
<img href=&quot;/images/#ImageFileName#&quot;>
</cfoutput>

Hope this is what you were looking for. FTK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top