Giter VIP home page Giter VIP logo

nginx-image-resizer's Introduction

nginx-image-resizer

./images/26946324088_5b3f0b1464_o.png

Docker Image

Nginx 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.

Build Image

docker build -t ghcr.io/appleboy/nginx-image-resizer .

RUN Image

docker run --restart always \
  -p 8002:80 \
  -e NGINX_HOST=localhost \
  -e IMAGE_HOST="http://localhost:9000" \
  ghcr.io/appleboy/nginx-image-resizer

Paramemter

Parameter required default value
NGINX_HOST true
IMAGE_HOST true
JPG_QUALITY false 95
EXPIRE_TIME false 7d
MEMORY_SIZE false 20m
CACHE_NAME false cache_zone
CACHE_SIZE false 40m
INACTIVE_TIME false 30d

example

Start minio and nginx-image-resizer using docker-compose.yml

docker-compose up -d

set minio environment as following

MINIO_ROOT_USER: YOUR_MINIO_ROOT_USER
MINIO_ROOT_PASSWORD: YOUR_MINIO_ROOT_PASSWORD

set bucket as public permission.

mc config host add minio http://localhost:9000 MINIO_ACCESS_KEY MINIO_SECRET_KEY
mc anonymous set public minio/test

open browser as following

# format 1: http://localhost:8002/resize_image_width/bucket_name/image_name
http://localhost:8002/300/test/test.png
# format 2: http://localhost:8002/${image_width}x${image_height}/bucket_name/image_name
http://localhost:8002/300x200/test/test.png

Benchmark

without nginx proxy cache:

echo "GET http://localhost:8002/310/test/26946324088_5b3f0b1464_o.png" | vegeta attack -rate=100 -connections=1 -duration=1s | tee results.bin | vegeta report
Requests      [total, rate]            100, 101.01
Duration      [total, attack, wait]    8.258454731s, 989.999ms, 7.268455731s
Latencies     [mean, 50, 95, 99, max]  3.937031678s, 4.079690985s, 6.958110121s, 7.205018428s, 7.268455731s
Bytes In      [total, mean]            4455500, 44555.00
Bytes Out     [total, mean]            0, 0.00
Success       [ratio]                  100.00%
Status Codes  [code:count]             200:100
Error Set:

with nginx proxy cache:

echo "GET http://localhost:8002/310/test/26946324088_5b3f0b1464_o.png" | vegeta attack -rate=100 -connections=1 -duration=1s | tee results.bin | vegeta report
Requests      [total, rate]            100, 101.01
Duration      [total, attack, wait]    993.312255ms, 989.998ms, 3.314255ms
Latencies     [mean, 50, 95, 99, max]  3.717219ms, 3.05486ms, 8.891027ms, 12.488937ms, 12.520428ms
Bytes In      [total, mean]            4455500, 44555.00
Bytes Out     [total, mean]            0, 0.00
Success       [ratio]                  100.00%
Status Codes  [code:count]             200:100
Error Set:

Reference

nginx-image-resizer's People

Contributors

appleboy avatar osnosov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nginx-image-resizer's Issues

Can't run whit this docker-compose.yml

2018/09/18 08:27:27 [emerg] 16#16: invalid keys zone size "keys_zone=cache_zone:" in /etc/nginx/conf.d/default.conf:1
nginx: [emerg] invalid keys zone size "keys_zone=cache_zone:" in /etc/nginx/conf.d/default.conf:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.