{"id":15318334,"url":"https://github.com/appleboy/nginx-image-resizer","last_synced_at":"2025-04-15T01:43:14.072Z","repository":{"id":41867349,"uuid":"125178462","full_name":"appleboy/nginx-image-resizer","owner":"appleboy","description":"Docker Container of real time image resizing and caching","archived":false,"fork":false,"pushed_at":"2024-06-17T14:21:51.000Z","size":152,"stargazers_count":89,"open_issues_count":1,"forks_count":26,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T08:32:41.211Z","etag":null,"topics":["image-processing","image-resizer","nginx","nginx-proxy"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appleboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.paypal.me/appleboy46"]}},"created_at":"2018-03-14T08:17:17.000Z","updated_at":"2025-03-12T14:06:26.000Z","dependencies_parsed_at":"2024-02-17T08:43:49.289Z","dependency_job_id":null,"html_url":"https://github.com/appleboy/nginx-image-resizer","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.020408163265306145","last_synced_commit":"3120c576071ee87f3e6853ef2b7facf59b01f27d"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fnginx-image-resizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fnginx-image-resizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fnginx-image-resizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fnginx-image-resizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleboy","download_url":"https://codeload.github.com/appleboy/nginx-image-resizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248926496,"owners_count":21184450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","image-resizer","nginx","nginx-proxy"],"created_at":"2024-10-01T08:59:44.212Z","updated_at":"2025-04-15T01:43:14.054Z","avatar_url":"https://github.com/appleboy.png","language":"Shell","funding_links":["https://www.paypal.me/appleboy46"],"categories":[],"sub_categories":[],"readme":"# nginx-image-resizer\n\n![./images/26946324088_5b3f0b1464_o.png](./images/26946324088_5b3f0b1464_o.png)\n\n[![Docker Image](https://github.com/appleboy/nginx-image-resizer/actions/workflows/docker.yml/badge.svg?branch=master)](https://github.com/appleboy/nginx-image-resizer/actions/workflows/docker.yml)\n\nNginx Image Resizer is a Docker-based tool that uses Nginx and ImageMagick to dynamically resize images. When you run this Docker image, you can specify the size of the image through URL parameters, and Nginx Image Resizer will return the resized image. This tool is particularly useful for websites and applications that need to dynamically adjust image sizes.\n\n## Build Image\n\n```bash\ndocker build -t ghcr.io/appleboy/nginx-image-resizer .\n```\n\n## RUN Image\n\n```bash\ndocker run --restart always \\\n  -p 8002:80 \\\n  -e NGINX_HOST=localhost \\\n  -e IMAGE_HOST=\"http://localhost:9000\" \\\n  ghcr.io/appleboy/nginx-image-resizer\n```\n\n## Paramemter\n\n| Parameter   | required | default value |\n|-------------|--------|----|\n| NGINX_HOST  | true   |    |\n| IMAGE_HOST  | true   |    |\n| JPG_QUALITY | false  | 95 |\n| EXPIRE_TIME | false  | 7d |\n| MEMORY_SIZE | false  | 20m |\n| CACHE_NAME | false  | cache_zone |\n| CACHE_SIZE | false  | 40m |\n| INACTIVE_TIME | false  | 30d |\n\n## example\n\nStart [minio](https://min.io/) and nginx-image-resizer using docker-compose.yml\n\n```sh\ndocker-compose up -d\n```\n\nset minio environment as following\n\n```sh\nMINIO_ROOT_USER: YOUR_MINIO_ROOT_USER\nMINIO_ROOT_PASSWORD: YOUR_MINIO_ROOT_PASSWORD\n```\n\nset bucket as public permission.\n\n```sh\nmc config host add minio http://localhost:9000 MINIO_ACCESS_KEY MINIO_SECRET_KEY\nmc anonymous set public minio/test\n```\n\nopen browser as following\n\n```sh\n# format 1: http://localhost:8002/resize_image_width/bucket_name/image_name\nhttp://localhost:8002/300/test/test.png\n# format 2: http://localhost:8002/${image_width}x${image_height}/bucket_name/image_name\nhttp://localhost:8002/300x200/test/test.png\n```\n\n## Benchmark\n\nwithout nginx proxy cache:\n\n```sh\necho \"GET http://localhost:8002/310/test/26946324088_5b3f0b1464_o.png\" | vegeta attack -rate=100 -connections=1 -duration=1s | tee results.bin | vegeta report\nRequests      [total, rate]            100, 101.01\nDuration      [total, attack, wait]    8.258454731s, 989.999ms, 7.268455731s\nLatencies     [mean, 50, 95, 99, max]  3.937031678s, 4.079690985s, 6.958110121s, 7.205018428s, 7.268455731s\nBytes In      [total, mean]            4455500, 44555.00\nBytes Out     [total, mean]            0, 0.00\nSuccess       [ratio]                  100.00%\nStatus Codes  [code:count]             200:100\nError Set:\n```\n\nwith nginx proxy cache:\n\n```sh\necho \"GET http://localhost:8002/310/test/26946324088_5b3f0b1464_o.png\" | vegeta attack -rate=100 -connections=1 -duration=1s | tee results.bin | vegeta report\nRequests      [total, rate]            100, 101.01\nDuration      [total, attack, wait]    993.312255ms, 989.998ms, 3.314255ms\nLatencies     [mean, 50, 95, 99, max]  3.717219ms, 3.05486ms, 8.891027ms, 12.488937ms, 12.520428ms\nBytes In      [total, mean]            4455500, 44555.00\nBytes Out     [total, mean]            0, 0.00\nSuccess       [ratio]                  100.00%\nStatus Codes  [code:count]             200:100\nError Set:\n```\n\n## Reference\n\n* [Nginx: Real time image resizing and caching](https://github.com/sergejmueller/sergejmueller.github.io/wiki/Nginx:-Real-time-image-resizing-and-caching)\n* [NGINX reverse proxy image resizing + AWS S3](https://medium.com/merapar/nginx-reverse-proxy-image-resizing-aws-cece1db5da01)\n* [Nginx dynamic image resizing with caching](https://stumbles.id.au/nginx-dynamic-image-resizing-with-caching.html)\n* [High‑Performance Caching with NGINX and NGINX Plus](https://www.nginx.com/blog/nginx-high-performance-caching/)\n* [NGINX and NGINX Plus Deliver Responsive Images Without the Headaches](https://www.nginx.com/blog/responsive-images-without-headaches-nginx-plus/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fnginx-image-resizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleboy%2Fnginx-image-resizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fnginx-image-resizer/lists"}