| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project sets up a responsive image server using NGINX in Docker. The server dynamically resizes images based on URL parameters and caches the resized images to improve performance.
. ├── Dockerfile # Dockerfile for building the NGINX image with image filter module ├── docker-compose.yml # Docker Compose file for setting up the service ├── nginx-config/ # Directory containing NGINX configuration files │ └── image.conf # NGINX configuration file for the image server └── README.md # Project documentation
Clone the repository to your local machine:
git clone git@github.com:shukebeta/responsive-image-server.git
cd responsive-image-serverCreate the directories for the image files and cache:
sudo mkdir -p /data/{files,nginx-images-cache}
sudo chmod -R 777 /data/{files,nginx-images-cache}Build and start the Docker container using Docker Compose:
docker-compose up --buildThis will:
The nginx-config/image.conf file contains the configuration for handling image resizing and caching:
Once the server is running, you can access it on http://localhost:3333.
To resize an image, use the following URL pattern:
http://localhost:3333/{prefix}{size}/{image_path}
For example, to resize an image named example.jpg to a width of 300px, access:
http://localhost:3333/300/example.jpg or http://localhost:3333/w300/example.jpg
If you want to resize the same image to a height of 300,
http://localhost:3333/h300/example.jpg
Resizing Server (port 8888):
Caching Server (port 80):
To stop the server, run:
docker-compose downThis will stop and remove the Docker container.
| Back | FazBrowse Home | New Git URL |