A PHP-based image gallery application with MongoDB backend, built with Docker for development.
This is development code. For the application to work correctly, you must run make permissions after starting the containers to set proper file ownership for image uploads.
- User registration and authentication
- Image upload with watermarking
- Thumbnail generation
- Private/public image galleries
- Favorites system
- MongoDB database backend
- Docker & Docker Compose
- Make
- Linux/WSL (for proper file permissions)
-
Clone the repository
git clone https://github.com/kox13/image-gallery.git
-
Start the application
make start
-
Set up permissions (Required)
make permissions
Important: You may need to log out and back in after running this command for group permissions to take effect.
-
Access the application
- Application: http://localhost:8080
- MongoDB: localhost:27017
Starts the Docker containers in detached mode.
make startStops all containers and clears cached images.
make stopSets correct file ownership and permissions for the application to handle image uploads. This command:
- Changes ownership of project files to
www-data:www-data - Sets directory permissions to 775
- Adds your current user to the
www-datagroup
make permNote: After running this command for the first time, log out and back in for group membership changes to take effect.
Removes all uploaded images from the cache directory.
make clcacheCopies the vendor folder from the Docker container to the host machine. Useful for IDE autocompletion and local development.
make cpvendorRemoves all Docker volumes associated with the project (vendor_data, mongodb_data, mongodb_config).
make rmvimage-gallery/
├── src/
│ ├── classes/ # Application classes
│ │ ├── controllers/ # MVC controllers
│ │ ├── models/ # Database models
│ │ ├── view/ # View handling
│ │ ├── App.php # Main application class
│ │ └── Database.php # Database connection
│ ├── views/ # View templates
│ ├── web/ # Public web root
│ │ ├── static/ # CSS, fonts, static images
│ │ ├── images/ # User uploaded images (git-ignored)
│ │ └── front_controller.php
│ ├── admin.js # MongoDB admin user init script
│ └── user.js # MongoDB app user init script
├── docker-compose.yml # Docker services configuration
├── Dockerfile # PHP-Apache container definition
├── Makefile # Build and utility commands
└── README.md # This file
- Database name:
gallery - Connection: Configured in
src/classes/Database.php - Host:
mongodb:27017(internal Docker network)
- Memory limit: 512M
- Upload max filesize: 1MB
- Start containers:
make start - Set permissions:
make permissions(first time only) - Develop and test
- Stop containers:
make stop(when done)