rusty338 Posted January 13, 2011 Share Posted January 13, 2011 I'm designing a site that can store photo galleries. So an 'x' number of images will be in a gallery, right now there is not limit, I'm wondering to make this work if I need one. I want for each image to have an alt tag - or even a description, same kind of idea. Now, I'm not really sure how to design a database for this. Should I limit each gallery to have only say 200 images, and in a table only have 200 different fields? Any advice or leads would be greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/224295-need-ideas-for-database-design-for-html-alt-tags/ Share on other sites More sharing options...
trq Posted January 13, 2011 Share Posted January 13, 2011 Should I limit each gallery to have only say 200 images, and in a table only have 200 different fields? Why would you limit the gallery to 200 images, and why would it take 200 fields to store 1 image? All you would really need to store are the path to the actual image, the alt , height and width attributes, a description and a few foreign keys relating the image to an owner, and gallery. Quote Link to comment https://forums.phpfreaks.com/topic/224295-need-ideas-for-database-design-for-html-alt-tags/#findComment-1158877 Share on other sites More sharing options...
ignace Posted January 13, 2011 Share Posted January 13, 2011 All you would really need to store are the path to the actual image Or store the image in your DB, very handy if it turns out your hosting company only creates back-ups of the DB files. Quote Link to comment https://forums.phpfreaks.com/topic/224295-need-ideas-for-database-design-for-html-alt-tags/#findComment-1159021 Share on other sites More sharing options...
rusty338 Posted January 13, 2011 Author Share Posted January 13, 2011 Thank you for the reply guys. It was late and I had a different way in mind, but this helps, thanks Quote Link to comment https://forums.phpfreaks.com/topic/224295-need-ideas-for-database-design-for-html-alt-tags/#findComment-1159077 Share on other sites More sharing options...
ttocskcaj Posted January 21, 2011 Share Posted January 21, 2011 have a table with photo_url - the location of the photo alt_text - the alternitive text to display userid - the userid of the owner. then when it comes to something like showing all the photos for a user. you can loop through each row that has the users id. use the photo_url to show the photo (src="") and the alt_text to show the alt text in the image tag. Quote Link to comment https://forums.phpfreaks.com/topic/224295-need-ideas-for-database-design-for-html-alt-tags/#findComment-1162872 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.