A fully functional image gallery with upload capabilities using PHP, HTML, jQuery, AJAX, JSON, Bootstrap, CSS, and MySQL. This project includes a detailed step-by-step solution with code explanations and documentation, making it a comprehensive tutorial for learning.
Topics: php, mysql, blog, ajax, bootstrap, jquery, css, image gallery, file upload
-
Clone the repository:
git clone https://github.com/yourusername/simple-image-gallery.git
-
Navigate to the project directory:
cd simple-image-gallery -
Set up the database:
- Create a MySQL database named
image_gallery. - Import the provided SQL file to create the necessary table:
mysql -u yourusername -p image_gallery < db/database.sql
- Create a MySQL database named
-
Update the database configuration:
- Copy
config.sample.phptoconfig.php:cp config.sample.php config.php
- Open
config.phpand update the database configuration details.
- Copy
-
Directory Permission:
- If you encounter permission issues, you might need to set more permissive permissions, such as chmod 777, which grants read, write, and execute permissions to everyone:
chmod 777 assets/uploads
- Open
config.phpand update the database configuration details.
- If you encounter permission issues, you might need to set more permissive permissions, such as chmod 777, which grants read, write, and execute permissions to everyone:
-
Start the development server:
php -S localhost:8000
-
Access the application:
- Open your web browser and navigate to
http://localhost:8000.
- Open your web browser and navigate to
Here’s a basic file structure for your simple-image-gallery application:
simple-image-gallery/ │ ├── index.html ├── db/ │ └── database.sql ├── src/ │ ├── fetch-image.php │ └── upload.php ├── include/ │ ├── config.sample.php │ └── db.php ├── assets/ │ ├── css/ │ │ └── style.css │ ├── js/ │ │ └── script.js │ └── uploads/ │ │ └── (uploaded images will be stored here) ├── README.md └── .gitignore 