I am going to build a PHP photo gallery from scratch but I am trying to determine the best way of doing this. I plan on uploading all photos into a single folder there will not be sub folders because I don't need separate albums created.
I have come up with two different ways of getting the pictures to display. My first method would be to store all of the picture names in a MySQL database and just use a SELECT * FROM pictures
and just have it loop through and echo out the HTML <img>
tags for each picture.
Another method would be to use just PHP to get a listing of all files in the picture directory and have it loop through doing the same echo HTML <img>
tags like mentioned above.
Is there any advantages or disadvantages to using either method? Maybe someone has a better solution I am just making one from scratch for learning purposes.