How do I store pictures in a db and then display the pictures on my site? for each item stored in my db i want to display a picture of it. i upload the location in memory of the picture using a form and store it but after that i am lost. how do I use this location to display the image. I have read books, other posts and various sites but still i can't get it to work.
Any ideas at all will be very much appreciated
store and display images in a db
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
you store the url of sorts to get to the image. Not necessarily a full url, as that will waste space with redundancy.. so in your image retrieval function, you just tack on the information needed to create a qualified url the browser can use to access the image.
Alternately, you can create a script that sends the image to the browser. you can find out how these are done by using the following forum search: [devnet]+force +download[/devnet]
Alternately, you can create a script that sends the image to the browser. you can find out how these are done by using the following forum search: [devnet]+force +download[/devnet]
when i am adding a new product to the db i also add an image such as pic.gif typed in by the user. Then to display this i use
where $file is equal to what the user typed in i.e pic.gif but all that is displayed is a white box with a red x in it. Do you know what I am doing wrong?? Thanks
Code: Select all
<?php echo '<td width="7%" align="center"><img src="'.$file.'" alt="my picture"/></td></tr>';
?>