Ires
is image resizer gem.
<!-- Usually -->
<%= ires_tag(path: "image_01.jpg", width: 90, height: 120) %>
<!-- Using image_tag options -->
<%= ires_tag(path: "http://example.com/image_02.jpg", width: 200, height: 200, Ires::Mode::CROP, alt: "example image") %>
Ires::Service.path(path: '<FULL IMAGE PATH>', width: 400, height: 300)
=> /ires/<resize image path>
info | mode |
---|---|
Resize | Ires::Mode::RESIZE (default) |
Cropping | Ires::Mode::CROP |
Rsize after Cropping | Ires::Mode::RESIZE_TO_CROP |
Filter of resize image.
info | type |
---|---|
All | Ires::Type::ALL (default) |
Smaller than | Ires::Type::SMALLER |
Larger than | Ires::Type::LARGER |
Default: 30days
<%= ires_tag(path: '/image.jpg', width: 400, height: 300, expire: 7.days) %>
public
├── image.jpg
└── ires
├── crop
│ ├── 20171019_image_120x90_crop.jpg
│ ├── 20171117_image_200x200_crop.jpg
│ └── 20171117_image_400x300_crop.jpg
├── resize
│ ├── 20171019_image_120x90_resize.jpg
│ ├── 20171117_image_200x200_resize.jpg
│ └── 20171117_image_400x300_resize.jpg
└── resize_to_crop
├── 20171019_image_120x90_resize_to_crop.jpg
├── 20171117_image_200x200_resize_to_crop.jpg
└── 20171117_image_400x300_resize_to_crop.jpg
Parse URL & Create directory by parse URL.
Add this line to your application's Gemfile:
gem 'ires'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ires
- It works only with
linux
anddarwin
now. - Can build only linux(.so)in this docker.
Docker environment.
$ docker build -t ires:v1 .
# Into the ires container.
$ docker run -it -v $(pwd):/go/src/github.com/endotakuya/ires -p 3000:3000 ires:v1 /bin/bash
Working in ires container.
Package manager is dep.
# Dependent resolution
$ dep ensure
# Output to a shared object.
$ CGO_ENABLED=1 GOOS=linux go build -v -buildmode=c-shared -o shared/linux/ires.so ext/main.go
※ In the current Docker, you can build only linux environment. ※ If you want to build in other environments, add GCC or install Go on the host side.🙇
$ test/dummy/bin/rails s -b 0.0.0.0
The gem is available as open source under the terms of the MIT License.