silverglade Posted June 21, 2011 Share Posted June 21, 2011 Hi, I want to make an image gallery from user submitted images to and from the database. The thing is, I don't want to look at a tutorial to do it. I want to come up with it from scratch (pseudocode). The problem is, I can't find anything in the "files" section of my books, neither is it in the "database" sections, and it doesn't seem to give me any clue of how to do that sort of thing. I have "PHP5 and MYSQL Bible" kind outdated but good, and "PHP in a nutshell" great, and "php for dummies", decent. Does anyone know what I would look under to learn how to store images in a database and then output them from the database onto a page? Ideally I would store them in an array and loop the array contents out. I don't know. Any help greatly appreciated. Quote Link to comment Share on other sites More sharing options...
trq Posted June 21, 2011 Share Posted June 21, 2011 Think about how you store images now (for use in plain HTML) for use in a web page. Doing it in PHP is not going to be any different, you just need to make PHP generate that same HTML for you. If however you would like to extend this idea somewhat and have comments for the images for instance, then you might use a database to link the images to a comment. How would you do that? You need to store some sort of reference to the image in the database, what reference do you have? A file system path. Quote Link to comment Share on other sites More sharing options...
silverglade Posted June 21, 2011 Author Share Posted June 21, 2011 Thank you for that. I will read more about using files and directories then. And figure out how to store an image's path in a database, then extracting that to print out img src's. I think I mainly have a creative thinking problem. Not necessarily a not knowing problem. The books give you the pieces of a puzzle I think, it is up to me to learn to put the pieces together in different ways. I will go back to my books. Thanks Thorpe. :) Quote Link to comment Share on other sites More sharing options...
spiderwell Posted June 21, 2011 Share Posted June 21, 2011 rather than save a path in the database, just save the file name and have the path as a site variable/constant. that would be easier to manage I think Quote Link to comment Share on other sites More sharing options...
silverglade Posted June 21, 2011 Author Share Posted June 21, 2011 ok thank you. 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.