How to add images to my database tables iin SQL server 2008 R2

Hey guys, I have a table that contains information on products, I want to add an image to each product, and am not sure on which is the best way to do this. i see that there is an image data type in SQL server, some research tells me this is not an advised approach. i was hoping that I could just have a folder in my project called database images and then link each product to its own in image in this folder, so when a query pulls all the info on the product out, then an image is also added to the output.

Can anyone advise on how this can be done?

Many thanks!!!

store the images in a folder, and put the path to the image into the products table

I tried this but which data type is this using? I set teh type to image and it of course required a byte. I feel so close!

use VARCHAR – the path you’re storing is a character string

Thanks. I changed my datatype to varchar and added this in the field of the picture column:
img src=“url”
then in my out put I run this:
echo '<br/> picture: '.$row[‘picture’];

But it only displays the text stored instead of the grabbing the image from the directory. Is there something wrong with how I am listing the image directory?

Thanks for your help.

looks like you forgot the html IMG tag

store your path string like this: /imagefolder/lolcat.jpg

then display it like this: <img src=“/imagefolder/lolcat.jpg” alt=“lolcat”>

Thanks. I cannot get it to work, but I will keep trying, I cant display it by using the source name, it had to be like this somehow as there will be many images:

echo ‘<br/> picture: <img src="’.[‘picture’].'">;

I appreciate your help.

can’t help you any further, man, this is the database forum and i don’t do php

You already helped me a lot, thanks man!