GAT Posted April 2, 2003 Share Posted April 2, 2003 Hello, I am going to create a graffiti database website. I have over 500 images that i wish to store in a MYSQL datbase. The images will be split into 10 or so sections according to the area their from. I heard it is better to store the image path rather than the image its self in the db, as loading time will be reduced. I also have myadmin, so this could make things easier. So basicaly i want to know how to set that database out?? what tables and fields would i need to produce what i outlined above? i basicaly want sections of thumbnails that link to their appropriate pictures on the DB. and for them to be pulled on to one universal page. any help anyone can give me will me much apreciated. As this is the first time i ever attempted using php-mysql. Quote Link to comment Share on other sites More sharing options...
DocSeuss Posted April 2, 2003 Share Posted April 2, 2003 Well just for that functionality I would only use one table with the fields like picture_ID, section_ID, picture_URL the picture_ID\'s would be unique numbers or names just some way to uniquely Identify the picture. from there you can determin the url and what section they belong to. if you have a standard way of naming the pictures and they are stored in a standard way, you could get by with only picture_ID and section_ID and build the url dynamically based on your standard. Quote Link to comment Share on other sites More sharing options...
GAT Posted April 2, 2003 Author Share Posted April 2, 2003 ok, i undersand that i am to store the URL in the images folder. BUT where do i have the actual image folder....simply on the server? (or at the moment, its all running from htdocs folder. So just in there?) AND i want the images to work as thumbnails. So when a thumbnail is clicked on, what sort of code would be used to pull the image from the appropriate db? a query of some sort, but like i said im well ameture....so....i dont know. but thanks, its great to get some help Quote Link to comment Share on other sites More sharing options...
DocSeuss Posted April 2, 2003 Share Posted April 2, 2003 well you can store the images anywhere on the server that a webpage has access to. as far as the code for the thumbnails I would prolly set it up as just make the img a link to a php page that will parse the information out the link would look something like showpic.php?pic_id=mycat then in the showpic.php file you would get the pic id from the url using $id = $_GET[\'pic_id\'] then use $id to search the database for the url and sections would be pretty much the same a link to a specific section my look like showsect.php?sect_id=animals then in the showsect page you would get the variable $section = $_GET[\'animals\'] then search the database for all the pics that have a section id of animals since you are using thumbnails also you might have to create another field in your database with the path to the thumbnail. hope all of this doesn\'t confuse you. Quote Link to comment Share on other sites More sharing options...
GAT Posted April 2, 2003 Author Share Posted April 2, 2003 yeh, i did think about having the thumb\'s all in the db too....because obviously their will be the same amount of thumbs as their will pics. BUT if im storing all the thumbs in the db, in the site ideally i would like about 30 on each page. so can you lets say have a 5x6 table (=30) and somehow have the thumbnails dynamicaly* put in the cells. Or would you have to put a path to the individual image in the db, in the cell. Also, (sorry please bear with me) can the thumbnails have their parent images links designated to them in the db. so no html has to be written. So, if you had a selection of thums on a page...and clicked on one it would go to its big image automatically. I think stage one for me is to create a db with a images folder and a thums folder with one of each in them, and try to get it to work fo just one image. thanks for your help and advice though Quote Link to comment Share on other sites More sharing options...
DocSeuss Posted April 2, 2003 Share Posted April 2, 2003 no prob that is the best way to approch any problem is to break it down into smaller problems. don\'t get discouraged you dealling with PHP, MYSQL, and database theory. none of these is \"easy\" by itself stick in there. There always seems to be someone on these forums to help when you get stuck. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.