Skip to main content
Known Participant
December 22, 2008
Question

Database images

  • December 22, 2008
  • 18 replies
  • 2296 views
I am using CF developers edition, sql 2005 and dreamweaver cs4 I have followed many tutorial on hoe to do this but I still get the same problem. I have built a record set from my db to display dynamic images. The images are stored in a folder outside of my database. I have a table with a column that has the path to the image file within the record set for example I have a varchar coulmn and the record is c:/documentandsettings/images/1000.png or something like that. Now when I try and display the image from the record set in dreamweaver I get the location to the image to display but not the actual image. What am I doing wrong? Please help
This topic has been closed for replies.

18 replies

Inspiring
December 24, 2008
You either store the correct URL path to the web accessible image file
in your database or you derive the correct URL path from the file system
path you have stored in the database.

Then you use this path in an <img...> as Dan suggested.

OR

You store the actual image in the database as a BLOB (Binary Large
OBject). But let's not confuse you.


Inspiring
December 24, 2008
Images are generally displayed with an img tag. You have yet to mention any attempt to use one.
Known Participant
December 24, 2008
Ok i get that my images need to be in my webroot folder but then how do I display them dynamically from a record set that has the other information about my products from my database in the record set? My goal is to set up a record set from my database that has information about my products, ie size, color and my images both the thumbnail and the larger view and set up a master detail page in my shopping cart that i can repeat for each records set so that I can just drop the record set fields into the master detail page so that is repeats for all of my products.
Inspiring
December 23, 2008
looking at the path to your images folder, i would guess it is NOT under
your website's root. what that means is your images are NOT web-accessible.

either:
a) store your images in a folder under your webroot (i.e. if your
website is in C:\Inetpub\wwwroot\mysite, store them in
C:\Inetpub\wwwroot\mysite\images)

b) or use an intermediary cfm page to serve up your images located
outside of your webroot. here is a link to an adobe technote on how to
stream images using CF:
http://kb.adobe.com/selfservice/documentLink.do?micrositeId=MS_Customer&externalID=kb405330



Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Known Participant
December 22, 2008
Thank you for all of your support and help it was so nice to check back and see answers to my question.

I am trying to display these images in a table in dreamweaver for a web site I am building. Ian you indicated that i need a url but how will i change all of the paths to reflect each image I want without having to alter my database because i still use that database for work on my local computer. I also wanted to mention that I and using CF to build and test this site locally but will upload the site to a server eventually. Again thanks for all the help it means alot to me
Inspiring
December 22, 2008
I don't know how you attempt to display the image but I suggest using:

<img src="#nameofcolumnofimage#" width="100" height="100">

hope it helps
Inspiring
December 22, 2008
ibejaminben,

Can you post the code you are using any the error messages, if any, that you get when running the code?
Inspiring
December 22, 2008
ibejaminben wrote:
> I am using CF developers edition, sql 2005 and dreamweaver cs4 I have followed
> many tutorial on hoe to do this but I still get the same problem. I have built
> a record set from my db to display dynamic images. The images are stored in a
> folder outside of my database. I have a table with a column that has the path
> to the image file within the record set for example I have a varchar coulmn and
> the record is c:/documentandsettings/images/1000.png or something like that.
> Now when I try and display the image from the record set in dreamweaver I get
> the location to the image to display but not the actual image. What am I doing
> wrong? Please help
>

As Dan asked, how are you trying to display the image, but I'll hazard a
guess on what *might* be going wrong. I am going to assume that you
want to display an image on a web page but your database has a path like
"c:/documentandsettings/images/1000.png". This is a file path. To
display an image in a web page, you need an URL path. This is going to
look something like. http://www.mysite.com/images/1000.png or
/images/1000.png, or some version of that.

Inspiring
December 22, 2008
How are you attempting to display the image?