From 2b6ecc43df925f1a0801f0987a480ff634292e5c Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Sat, 30 Jan 2016 16:31:40 +0000 Subject: [PATCH 1/2] feat(version): bump --- controllers.go | 4 ++-- image.go | 1 - options.go | 2 ++ version.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers.go b/controllers.go index 0b2c38b..8050ab4 100644 --- a/controllers.go +++ b/controllers.go @@ -76,9 +76,9 @@ func formController(w http.ResponseWriter, r *http.Request) { method string args string }{ - {"Resize", "resize", "width=300&height=200&type=png"}, + {"Resize", "resize", "width=1000&type=jpeg"}, {"Force resize", "resize", "width=300&height=200&force=true"}, - {"Crop", "crop", "width=562&height=562&quality=95"}, + {"Crop", "crop", "width=1000&quality=95"}, {"Extract", "extract", "top=100&left=100&areawidth=300&areaheight=150"}, {"Enlarge", "enlarge", "width=1440&height=900&quality=95"}, {"Rotate", "rotate", "rotate=180"}, diff --git a/image.go b/image.go index e6a9f85..b7fe2f0 100644 --- a/image.go +++ b/image.go @@ -122,7 +122,6 @@ func Rotate(buf []byte, o ImageOptions) (Image, error) { } opts := BimgOptions(o) - opts.Rotate = bimg.Angle(o.Rotate) return Process(buf, opts) } diff --git a/options.go b/options.go index 0ec7409..505d2b5 100644 --- a/options.go +++ b/options.go @@ -33,6 +33,7 @@ type ImageOptions struct { // BimgOptions creates a new bimg compatible options struct mapping the fields properly func BimgOptions(o ImageOptions) bimg.Options { + debug("Options: %#v", o) return bimg.Options{ Width: o.Width, Height: o.Height, @@ -44,5 +45,6 @@ func BimgOptions(o ImageOptions) bimg.Options { Gravity: o.Gravity, Interpretation: o.Colorspace, Type: ImageType(o.Type), + Rotate: bimg.Angle(o.Rotate), } } diff --git a/version.go b/version.go index c3e9087..ec8c051 100644 --- a/version.go +++ b/version.go @@ -2,7 +2,7 @@ package main import "gopkg.in/h2non/bimg.v0" -const Version = "0.1.18" +const Version = "0.1.19" type Versions struct { ImaginaryVersion string `json:"imaginary"` From 1bcb2a82e18ae5ea08e26d960ffd940a97dbc26e Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Sat, 30 Jan 2016 16:33:25 +0000 Subject: [PATCH 2/2] feat(docs): add rotate param in endpoints --- README.md | 8 ++++++++ options.go | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60abf0b..b1df813 100644 --- a/README.md +++ b/README.md @@ -440,6 +440,7 @@ Crop the image by a given width or height. Image ratio is maintained - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -461,6 +462,7 @@ Resize an image by width or height. Image aspect ratio is maintained - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -479,6 +481,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -501,6 +504,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -520,6 +524,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -538,6 +543,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -609,6 +615,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` @@ -633,6 +640,7 @@ Accepts: `image/*, multipart/form-data`. Content-Type: `image/*` - file `string` - Only GET method and if the `-mount` flag is present - url `string` - Only GET method and if the `-enable-url-source` flag is present - force `bool` +- rotate `int` - norotation `bool` - noprofile `bool` - colorspace `string` diff --git a/options.go b/options.go index 505d2b5..0f0b53c 100644 --- a/options.go +++ b/options.go @@ -33,7 +33,6 @@ type ImageOptions struct { // BimgOptions creates a new bimg compatible options struct mapping the fields properly func BimgOptions(o ImageOptions) bimg.Options { - debug("Options: %#v", o) return bimg.Options{ Width: o.Width, Height: o.Height,