Skip to content

Commit

Permalink
Add new param aspect ratio (#1)
Browse files Browse the repository at this point in the history
* fix(docs): Docker image link

* refactor(docs): use preinstall.sh script from bimg repository

* refactor(docs): update preinstall.sh install URL

* refactor(docs): remove deprecated sharp benchmark results

* fix(usage): correct help message of 'allowed-origins'

* feat(max-allowed-size): add new option max-allowed-size in bytes (h2non#111)

* feat(max-allowed-size): add new option max-allowed-size in bytes

* fix(max-allowed-size): HEAD response handling

- consider 200~206 as valid HEAD response codes
- do not defer res.Body.Close() of HEAD request

* feat(version): bump to 0.1.29

* Update History.md

* fix(type): bimg v1.0.7 integration

* fix(type): bimg v1.0.7 integration

* fix(tests): integration with bimg v1.0.7

* Update .travis.yml

* fix(travis): use proper preinstall.sh URL

* feat(travis): add multi libvips testing environments

* fix(travis): remove libvips 8.5

* feat(History): update changes

* feat(version): bump to v0.1.30

* refacgor(version): add comments

* 1. remove the .godir as Heroku and Cloud Foundry remove the support. (h2non#117)

For the details, pls reference https://github.com/heroku/heroku-buildpack-go/blob/d21f5d37c9a7ca59349d6bb3a55aa1eb3607b570/CHANGELOG.md#v23-2015-12-17
2. Ignore the glide.lock

* Add backers & sponsors from open collective (h2non#119)

your open collective backers and sponsors can now appear directly on your readme. 
see how it'll look: https://github.com/apex/apex#backers
More info: https://github.com/opencollective/opencollective/wiki/Github-banner
Also add badges on top

* Deploy on Cloud Foundry PaaS (h2non#122)

* 1. remove the .godir as Heroku and Cloud Foundry remove the support.
  For the details, pls reference https://github.com/heroku/heroku-buildpack-go/blob/d21f5d37c9a7ca59349d6bb3a55aa1eb3607b570/CHANGELOG.md#v23-2015-12-17
2. Ignore the glide.lock

* Add the steps for the deployment on cloudfoundry

* fix(h2non#124): fast workaround to unblock Heroku deployment until the buildpack can be updated

* fix(.godir): add project name

* feat(docs): add maintainers section

* refactor(docs): update support badges

* feat(travis): use Go 1.8

* feat(docs): add new maintainer notice (thanks to @kirillDanshin)

* fix(docs): move toc top level sections

* Correcting the documentation, caching headers are always sent, regardless of being fetched from mount or by URL. (h2non#133)

* feat(Dockerfile): use libvips v8.5.5, Go v1.8.1 and bimg v1.0.8

* feat(version): bump to 0.1.31

* feat(History): update latest changes

* Supporting smart crop (h2non#136)

* Using bimg's new SmartCrop API

* Minor tweaks and fixes

* Allowing pre Go 1.5 versions to fail.

* feat(History): update changes

* feat(version): bump to v1.0.0

* feat(controllers): add smart crop form

* refactor(controller): add height for smart crop form

* feat(h2non#140): expose Content-Length header

* feat(version): bump to v1.0.1

* feat(changelog): update v1.0.1 changes

* feat(Docker): upgrade Go to v1.8.3 and libvips to v8.5.6

* fix(Docker): use proper SHA256 hash

* fix(server_test): assert content type header is present

* feat(History): add missing Docker changes

* Update README.md (h2non#143)

Small typo.

* Typos and minor language in help text (h2non#144)

* fix(h2non#146): handle proper response code range for max allowed size

* feat(version): bump to v1.0.2

* feat(docs): update maintainer note

* Adding the Gaussian Blur feature plus a few minor formatting with gofmt. (h2non#150)

* Adding the Gaussian Blur feature plus a few minor formatting changes with gofmt.

* Adding the Gaussian Blur to the BimgOptions instantiation method

* Adding the Gaussian Blur to the BimgOptions instantiation method - More documentation added

* fix(docs): CLI spec typo

* feat(version): bump to v1.0.3

* Mapping Blur URL params to the ImageOptions struct fields (h2non#152)

* feat(version): bump to 1.0.4

* feat(params): add stripmeta params

* feat(History): update version changes

* feat(version): bump to v1.0.5

* feat(version): bump to v1.0.6

* feat(version): bump to v1.0.7

* refactor(license): update copyright

* feat(docs): add sponsor ad

* refactor(docs): move sponsor banner

* feat(h2non#101): add pipeline endpoint implementation + smart crop (h2non#154)

* feat(h2non#101): add pipeline endpoint implementation + smart crop

* refactor(docs): update internal docs links

* refactor(docs): update author notes

* fix(tests): refactor Options -> Params

* feat(docs): add note about pipeline max operations

* feat(version): v1.0.8

* feat(docs): add note about Docker and Heroku

* feat(docs): add imagelayer badge

* feat(docs): add imagelayer badge

* feat(docs): add imagelayer badge

* feat(docs): add imagelayer badge

* refactor(docs): specify POST payloads in description

* feat(travis): add Go 1.9 support

* feat(vendor): add vendor dependencies

* refactor(Gopkg): define version

* feat(vendor): support dependencies vendoring

* refactor(requirements): add Go 1.6+ as minimum requirement

* refactor(Dockerfile): use local source copy

* debug(travis)

* debug(travis)

* debug(travis)

* debug(travis)

* debug(travis)

* fix(h2non#157): disable gzip compression support

* feat(version): bump to v1.0.9

* feat(h2non#156): support disable endpoints (h2non#160)

* feat(h2non#156): support disable endpoints

* fix(docs): remove no-form docs

* feat(bimg): upgrade to v1.0.16

* feat(version): bump to v1.0.10

* feat(Dockerfile): upgrade to Go 1.9.2

* feat(docs): update CLI usage help

* Add /fit action

* Add type=auto using client Accept header to auto negotiate type. (h2non#162)

* Add type=auto using client Accept header to auto negotiate type.

* Review feedback

* fix(test): remove unused variable body

* refactor(image): remove else statement

* feat(bimg): update to v1.0.17

* feat(version): bump to v1.0.11

* fix(type_test): use string for proper formatting

* refactor(docs): update CLI usage and minimum requirements

* Log hours in 24 hour clock (h2non#165)

* fix testdata image links (h2non#173)

* refactor(docs): remove codesponsor :(

* refactor(vendor): remove go-debug package from vendor

* feat: add docker-compose.yml

* fix(debug): implement custom debug function

* feat(vendor): upgrade bimg to v1.0.18

* feat(Docker): upgrade libvips to v8.6.2 (h2non#184)

* feat(Docker): upgrade libvips to v8.6.2

* feat(travis): add libvips v8.6 & Go v1.10 runtime environments

* feat(version): bump to v1.0.13

* feat(history): update changelog

* fix(Dockerfile): update version sha2 hash

* Fixes https by installing root CA certificates (h2non#186)

* Add Docker Compose note to README (h2non#174)

* add docker-compose.yml note

* feat(docs): add docker-compose.yml example

* feat(version): bump to v1.0.14

* Changing build steps (h2non#189)

* feat(version): bump to v1.0.15

* fix(docker): remove race detector (h2non#197)

* Add URL signature feature (h2non#194)

* Add URL signature feature

* Fix signature salt empty & key/salt check

* Drop salt as suggested in h2non#194 (h2non#200)

* Fix typo in documentation (h2non#202)

* Update README.md (h2non#207)

* Update README.md

Updates link in table of contents

* Update README.md

* Add new param aspect ratio

* return nil if aspect ratio is not parsable
  • Loading branch information
zhenqianz committed Aug 2, 2018
1 parent d5af7d9 commit f432993
Show file tree
Hide file tree
Showing 181 changed files with 15,756 additions and 299 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Expand Up @@ -2,15 +2,15 @@ root = true

[*.go]
charset = utf-8
indent_style = tabs
indent_style = tab
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
charset = utf-8
indent_style = tabs
indent_style = tab
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ Thumbs.db
# Folders
_obj
_test
.idea

# Architecture specific extensions/prefixes
*.[568vq]
Expand All @@ -33,6 +34,3 @@ bin/

imaginary
bin/imaginary

## ignore vendor packages
vendor/
76 changes: 68 additions & 8 deletions .travis.yml
@@ -1,13 +1,73 @@
language: go

sudo: required
dist: trusty

go:
- 1.7
- 1.6
- 1.5
- 1.4
- 1.3
- tip
- "1.10"
- "1.9"
- "1.8"
- "1.7"
- "1.6"
- "tip"

env:
- LIBVIPS=7.42
- LIBVIPS=8.2
- LIBVIPS=8.3
- LIBVIPS=8.4
- LIBVIPS=8.5
- LIBVIPS=8.6
- LIBVIPS=master

matrix:
allow_failures:
- env: LIBVIPS=7.42
- env: LIBVIPS=8.2
- env: LIBVIPS=8.3
- env: LIBVIPS=master

cache: apt

addons:
apt:
packages:
- gobject-introspection
- gtk-doc-tools
- libcfitsio3-dev
- libfftw3-dev
- libgif-dev
- libgs-dev
- libgsf-1-dev
- libmatio-dev
- libopenslide-dev
- liborc-0.4-dev
- libpango1.0-dev
- libpoppler-glib-dev
- libwebp-dev

before_install:
- curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash -
- go get ./...
- wget https://github.com/jcupitt/libvips/archive/$LIBVIPS.zip
- unzip $LIBVIPS
- cd libvips-$LIBVIPS
- test -f autogen.sh && ./autogen.sh || ./bootstrap.sh
- >
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
./configure
--disable-debug
--disable-dependency-tracking
--disable-introspection
--disable-static
--enable-gtk-doc-html=no
--enable-gtk-doc=no
--enable-pyvips8=no
--without-orc
--without-python
$1
- make
- sudo make install
- sudo ldconfig

script:
- cd ..
- go test -v -race -covermode=atomic
76 changes: 69 additions & 7 deletions Dockerfile
@@ -1,22 +1,54 @@
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM marcbachmann/libvips:latest
FROM ubuntu:16.04 as builder
MAINTAINER tomas@aparicio.me

ENV LIBVIPS_VERSION 8.6.3

# Installs libvips + required libraries
RUN \

# Install dependencies
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
automake build-essential curl \
gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-turbo8-dev libpng12-dev \
libwebp-dev libtiff5-dev libgif-dev libexif-dev libxml2-dev libpoppler-glib-dev \
swig libmagickwand-dev libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio-dev \
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev && \

# Build libvips
cd /tmp && \
curl -OL https://github.com/jcupitt/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz && \
tar zvxf vips-${LIBVIPS_VERSION}.tar.gz && \
cd /tmp/vips-${LIBVIPS_VERSION} && \
./configure --enable-debug=no --without-python $1 && \
make && \
make install && \
ldconfig && \

# Clean up
apt-get remove -y curl automake build-essential && \
apt-get autoremove -y && \
apt-get autoclean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Server port to listen
ENV PORT 9000

# Go version to use
ENV GOLANG_VERSION 1.7.1
ENV GOLANG_VERSION 1.10

# gcc for cgo
RUN apt-get update && apt-get install -y \
gcc curl git libc6-dev make ca-certificates \
gcc curl git libc6-dev make \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 43ad621c9b014cde8db17393dc108378d37bc853aa351a6c74bf6432c1bbd182
ENV GOLANG_DOWNLOAD_SHA256 b5a64335f1490277b585832d1f6c7f8c6c11206cba5cd3f771dcb87b98ad1a33

RUN curl -fsSL --insecure "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand All @@ -31,10 +63,40 @@ WORKDIR $GOPATH

# Fetch the latest version of the package
RUN go get -u golang.org/x/net/context
RUN go get -u github.com/h2non/imaginary
RUN go get -u github.com/golang/dep/cmd/dep

# Copy imaginary sources
COPY . $GOPATH/src/github.com/h2non/imaginary

# Compile imaginary
RUN go build -o bin/imaginary github.com/h2non/imaginary

FROM ubuntu:16.04

RUN \
# Install runtime dependencies
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
libglib2.0-0 libjpeg-turbo8 libpng12-0 libopenexr22 \
libwebp5 libtiff5 libgif7 libexif12 libxml2 libpoppler-glib8 \
libmagickwand-6.q16-2 libpango1.0-0 libmatio2 libopenslide0 \
libgsf-1-114 fftw3 liborc-0.4 librsvg2-2 libcfitsio2 && \
# Clean up
apt-get autoremove -y && \
apt-get autoclean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=builder /usr/local/lib /usr/local/lib
RUN ldconfig
COPY --from=builder /go/bin/imaginary bin/
COPY --from=builder /etc/ssl/certs /etc/ssl/certs

# Server port to listen
ENV PORT 9000

# Run the outyet command by default when the container starts.
ENTRYPOINT ["/go/bin/imaginary"]
# Run the entrypoint command by default when the container starts.
ENTRYPOINT ["bin/imaginary"]

# Expose the server TCP port
EXPOSE 9000
45 changes: 45 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Gopkg.toml
@@ -0,0 +1,34 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"

[[constraint]]
name = "github.com/rs/cors"

[[constraint]]
name = "gopkg.in/h2non/bimg.v1"
version = "^1.0"

[[constraint]]
name = "gopkg.in/h2non/filetype.v1"

[[constraint]]
name = "gopkg.in/throttled/throttled.v2"

0 comments on commit f432993

Please sign in to comment.