Forums

This topic is locked

Images in a SQL Database

Posted 08 Apr 2003 13:11:38
1
has voted
08 Apr 2003 13:11:38 Matt Jukes posted:
Hi all<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

I must be a complete dipstick if, but I can not sort this out. I have an SQL database and one field in it is suppose to hold images. I have tried many different formats but I can not get the images to display when called forward as part of an results page on a website.

I have tried;
C:/inetpub/wwwroot/rootfolder/images/image.gif

inetpub/wwwroot/rootfolder/images/image.gif

and many other expressions similar.

I used to use Access and that was much easier by just putting the img src URL of the file.

I thought that SQL would have a similar method of just recording the URL of the image however I can't find any information to support it.

If anyone has had the same problem and found a solution Please Please HELP!! any info or contributions would be SUPERB!! <img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle>

Thanks all.

Replies

Replied 08 Apr 2003 14:05:02
08 Apr 2003 14:05:02 Julio Taylor replied:
if you're using PHP, for example, you can do the following:

&lt;img src:"../folder/&lt;?php echo $query-&gt;Fields('file_name')?&gt;"&gt;

so basically you specify the path to then folder dynamically, and you use the database to store the name of the file itself (e.g. filename.gif)... otherwise you can store the entire relative path in the database.

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 14:09:18
08 Apr 2003 14:09:18 Matt Jukes replied:
Thanks,

thats what i was hoping for but I am using ASP would that work the same way.

Replied 08 Apr 2003 14:11:04
08 Apr 2003 14:11:04 Julio Taylor replied:
yes, it will work the same way. for the image source, just write the path (../folder/..) and then instead of the file name, just put the code to insert database data, in this case the field which stores your image name.

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 14:25:59
08 Apr 2003 14:25:59 Matt Jukes replied:
Thanks.

However I'm having a Welsh moment and can't sort it. I guess I need to Learn more SQL<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

img src:"/Inetpub/wwwroot/Folder/Folder/Folder/DSC00447.jpg

should I write the &lt;?asp.... in between the last folder and the image name and then put the image name inside the (' ') or am I completely wrong(probably)

Thanks
Replied 08 Apr 2003 14:26:46
08 Apr 2003 14:26:46 Julio Taylor replied:
&lt;img src:"/Inetpub/wwwroot/Folder/Folder/Folder/&lt;asp.......&gt;"&gt;

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 14:29:42
08 Apr 2003 14:29:42 Julio Taylor replied:
actually, no:

your path needs to be relevant to your site root... for example:

our location:

www.anysite.com/products/index.htm

images:
www.anysite.com/image/298.jpg

the path can either be:

&lt;img src="www.anysite.com/images/&lt;% .... %&gt;"&gt;
or
&lt;img src="../image/&lt;%...%&gt;"&gt;

-- J



------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 14:51:45
08 Apr 2003 14:51:45 Matt Jukes replied:
I AM SORRY FOR BEING A PLEB!!

I have put in,
&lt;img src="../images/Folder/&lt;%image.jpg%&gt;"&gt;

&

&lt;img src="../images/folder/image.jpg"&gt;

They do show an image placeholder however no image just that damn red X. I have tried the http: version and it does say downloading image etc but it never does just keeps going

I am really sorry for being so thick but I'm just having one of those days.<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Replied 08 Apr 2003 15:35:11
08 Apr 2003 15:35:11 Julio Taylor replied:
&lt;img src="="../images/Folder/&lt;%=(queryname.Fields.Item("imagefieldname".Value)%&gt;

where "imagefieldname" is the field in your database where you are storing the name of the file you are using, and "queryname" is the name of he query you are using.

does that help?

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 16:01:05
08 Apr 2003 16:01:05 Matt Jukes replied:
Okay,

I feel that i'm getting somewhere but where I ain't got a clue.

I have put

&lt;img src="localhost/images/Car_Clients/&lt;%=(e_coche.Fields.Item("Picture".Value)%&gt;"&gt;

into my results field where the image should be showing.
With or without the localhost part its the same. And in the DB i have just the filename i.e. image1.jpg.

When using the search the images on the results page are still shown as red X's but the properties of the images are correct. when clicked the image (which is the same just bigger) is shown as the name of the file.

I really don't get this if you can't help then I thankyou greatly for all the help you've given me. What you've said will work I can see that I just don't know what is going wrong at the moment.

Thanks
Replied 08 Apr 2003 16:05:03
08 Apr 2003 16:05:03 Julio Taylor replied:
to me it seems like the the path to the image is wrong. the x probably appears because thew browser can't track the image down...

try this:

1. right click on the current image (the one with the red x), click properties and copy down the URL. (e.g. localhost/images/image.gif)

2. copy the URL into your browser. does the image show? yes = the problem is somewhere else. no=the problem is with your path. check your images folder path.

let me know how you get on.

--J

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 08 Apr 2003 16:06:22
08 Apr 2003 16:06:22 Matt Jukes replied:
YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU SOOOOO MUCH I was doing it wrong somewhere along the line. I wrote out the same thing you had told me to in word, copied and pasted and VIOLA it work. Haven't got a clue why but it did.

THANKS AGAIN COULDN'T HAVE DONE THIS WITHOUT YOUR HELP.<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 08 Apr 2003 16:08:51
08 Apr 2003 16:08:51 Julio Taylor replied:
that's ok!

that's what we're here for! <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:

Reply to this topic