In the previous article about we have learned that how we create a dynamic gallery using PHP. Now in this tutorial we will see that how we create album based Image Gallery in PHP.
Its a very easy task to create PHP Image Album Gallery Script and does not involve too much efforts as we have already completed the tricky part about this series.
We will create another table which will hold the album id and Name of the album. We will also add one more column to our existing gallery table which will tell us that which image belongs to which album by using the id. You can checkout our previous article here
We will create the Album Table so that we will able to create Album based gallery using php and mysql.
Now we will also update the our gallery table so that we will be able to save the album name with the image. Or just run the below query it will add the album id column to the table.
Or you can use this table structure.
Now we will just update the code for saving the image to database with the album id. First of all we will create the functions for adding the album and getting the list of album.
Add Album Function
List Album Function
By using both the function we can add and list the album. Now we will create the album dropdown in the add gallery page.
Add Album Dropdown to Image Upload Form
Getting the list of the added album.
Now you can add the album to the image.
Now at final stage we will update the index page and add a new gallery page.
In the index page you will see only the name of the album and when you click over the name you will be redirected to the next page that is Gallery page and it will show the images according to the album id.
So we have completed our tutorial Album Based Image Gallery in PHP. Hope you like our tutorial i have also attached the complete project files which you can download form the bottom of the post. If you have any issues than please comment below. If you want any specific tutorial please comment below. Thank You.