- Keeps aspect ratio.
- Doesn't scale up, but scale down.
- Reflect orientation tag in EXIF of JPEG to pixels of resized image.
- Drops meta data.
Download binary for your environment from latest release, or go get
like:
go get -u github.com/minodisk/resizer/...
resizer
ENVIRONMENT
:development
orproduction
. In defaultproduction
GC_PROJECT_ID
: The project ID of Google Cloud.GC_STORAGE_BUCKET
: The bucket name of Google Cloud Storage.GC_SERVICE_ACCOUNT
: The base64-encoded service account JSON of Google Cloud.MYSQL_DATA_SOURCE_NAME
: The data source name of MySQL.ALLOWED_HOSTS
: The allowed hosts of resizing images. Specified with a string joined by,
. When unspecified, resizer will resize images in any host.MAX_HTTP_CONNECTIONS
curl http://your.host.name/?url=http%3A%2F%2Fexample.com%2Fimage.jpeg&width=800
GET http://your.host.name/
- Joint
key=value
parameters with&
.- The
value
should be URL-encoded.
- The
The URL of a resizing image. Required.
The host of the URL should be specified with hosts
in running option.
The size of resized image in pixel. In default 0
.
- An integer greater than or equal to
0
. - Specify
0
to both ofwidth
andheight
isn't allowed. - When
width
is0
.width
is guessed withheight
and the aspect ratio of the source image . - When
height
is0
.height
is guessed withwidth
and the aspect ratio of the source image . - The specified size is greater than the size of source image, resizer doesn't resize.
How to resize. contain
or cover
. Optional. In default contain
.
- When
width
orheight
is0
, specifiedmethod
is ignored and resizer resizes withcontain
method. - When specifies
contain
, resizer resizes image to fall into the specified size and doesn't clip. - When specifies
cover
, resizer resizes image to fill all pixels in the specified size and clips the outer of the specified size.
The format of the resized image. jpeg
or png
or gif
. In default jpeg
.
The quality of the resized image as jpeg
. 0
〜100
. In default 100
.
- Ignored, when
format
isn'tjpeg
.
- When resizes first time, response resized image data with the code as
2xx
. - When resizes second (or third or forth) time, response with code as
3xx
and redirects to the storage URL of that the resized image was saved.
Response with the code as 4xx
, and the reason will be written in the body.