Skip to content

Commit

Permalink
add output format
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Jun 18, 2017
1 parent 99047ca commit 77b578f
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 96 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ node_modules

# Optional REPL history
.node_repl_history
.DS_Store
.DS_Store

nginx-dbg_1.13.1-1~xenial_amd64.deb
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ FROM hyperknot/baseimage16:1.0.1
MAINTAINER [email protected]

ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
TERM=xterm container=docker DEBIAN_FRONTEND=noninteractive
TERM=xterm container=docker DEBIAN_FRONTEND=noninteractive \
NGINX_VERSION=1.13.1-1~xenial_amd64.deb

ADD ./build/nginx_1.13.1-1~xenial_amd64.deb /tmp
ADD ./build/nginx_${NGINX_VERSION} /tmp

# ADD ./build/nginx-dbg_${NGINX_VERSION} /tmp

# start
RUN \
Expand All @@ -17,13 +20,19 @@ RUN \
&& echo "deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx" | tee -a /etc/apt/sources.list \
&& echo "deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx" | tee -a /etc/apt/sources.list \

# update repo, install nginx and module to get dependencies
# update repo
&& apt-get update -y && apt-get upgrade -y --no-install-recommends --no-install-suggests \
&& apt-get install -y --no-install-recommends --no-install-suggests \
nano libgd3 gettext-base unzip \
&& dpkg --configure -a \

&& dpkg -i nginx_1.13.1-1~xenial_amd64.deb \
# install nginx
&& dpkg -i nginx_${NGINX_VERSION} \

# && dpkg -i nginx-dbg_${NGINX_VERSION} \

# delete dummy conf
&& rm -rf /etc/nginx/conf.d/default.conf \

# re-enable all default services
&& rm -f /etc/service/syslog-forwarder/down \
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ Nginx module - https://github.com/niiknow/docker-nginx-image-proxy/blob/master/b

Features:
- [x] image crop offset, credit: https://github.com/bobrik/nginx_image_filter
- [x] png automatically convert to jpeg if quality < 96, credit: https://github.com/JamesJJ/ngx_http_image_filter_module
- [x] /healthcheck endpoint
- [x] 302 redirect to origin server on proxy error
- [x] empty gif on other errors: 403, 404, 415, 500 or when URL is not on your whitelist
- [x] empty gif on other errors: 403, 404, 415, 500, 502, 503, 504
- [x] convert/force output to another format

# What does this solve?
You have a huge repository of images that need dynamic resize and cropping. Cloudinary can be expensive and redundant if you run your own CDN in front of this microservice.
Expand Down Expand Up @@ -37,14 +36,15 @@ Option Keys:

```yml
code: name - valid values - default
q: quality - 1-100 - 96 (default to best in case it's a jpg that already has been optimized)
q: quality - 1..100 - 96 (default to best in case it's previously optimized)
w: width - uint - null
h: height - uint - null
c: crop - null, 1 - null
rz: resize - null, 1 - 1
g: gravity - NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast *case-sensitive* - NorthWest
e: sharpen - 1..100 - 0
r: rotate - 0, 90, 180, 270 - 0
ofmt: bmp, jpg, jpeg, png, gif, webp - force output format
```
Options Usages:
Expand Down
5 changes: 1 addition & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ MAINTAINER [email protected]
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
TERM=xterm container=docker DEBIAN_FRONTEND=noninteractive



ADD ./ubuntu.sh /tmp/

ADD ./src/ /tmp/

# start
RUN \
Expand Down
Binary file modified build/nginx_1.13.1-1~xenial_amd64.deb
Binary file not shown.
Loading

0 comments on commit 77b578f

Please sign in to comment.