Image management using MySQL and image directory
A friend of mine told me that saving images in the database is not much of a good idea. Instead save it to the directory and then save it's name in the database and when I want to display the images in the 开发者_开发技巧browser I'm just going to use the name in the database to find the picture. Can anyone please guide me on how to do this starting from scratch? Any help would be much appreciated.
By the way I am using php and MySQL.
Do two things:
- accept more answers, here's how: https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work
- read this tutorial: http://articles.sitepoint.com/article/php-gallery-system-minutes
What is it exactly that you don't know how to do? Your question seems to contain its own answer:
- set up a directory for images, accessible to your web server
- copy some image files in there
- go to phpmyadmin and create a table with a filename field, for example of type varchar 100
- store the image filenames in the table
- write a php script that fetches image names and displays the HTML to load the images
精彩评论