• This repository has been archived on 23/Nov/2018
  • Stars
    star
    155
  • Rank 232,195 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

On-demand image sizing+delivery for responsive applications

Imgry

Imgry is an on-demand image delivery web service for responsive applications.

Usage

First install Go 1.7+ and copy the etc/imgry.conf.sample (the default is fine), then..

cd imgry/
make tools
make deps
make build
./bin/imgry-server -config=etc/imgry.conf

Open browser to:

http://localhost:4446/mybucket?url=http://i.imgur.com/vEZy2Oh.jpg

this will download the image from the source, cache it, persist it, and return the sized image (in this case, with zero sizing) to the client.

Now, some other variations:

Scale to 300x

http://localhost:4446/mybucket?url=http://i.imgur.com/vEZy2Oh.jpg&size=300x

Resize to exactly 300x300

http://localhost:4446/mybucket?url=http://i.imgur.com/vEZy2Oh.jpg&size=300x300

Resize to 300x300 and maintain aspect ratio

http://localhost:4446/mybucket?url=http://i.imgur.com/vEZy2Oh.jpg&size=300x300&op=cover

Same as above with a cropbox at points (x1:10%,y1:10%) to (x2:90%,y2:90%)

http://localhost:4446/mybucket?url=http://i.imgur.com/vEZy2Oh.jpg&size=300x300&op=cover&cb=0.1,0.1,0.9,0.9

Webapp usage

<img src="http://localhost:4446/mybucket?url=http%3A%2F%2Fi.imgur.com%2FvEZy2Oh.jpg&size=300x300&op=cover" />

Caching and persistence

Imgry is built with some clever caching such as:

  • A layered cache store that stores/loads data from memory > on-disk (boltdb) > s3
  • Once an image has been downloaded once, every other sizing operation will be loaded from the chainstore
  • Saving to the on-disk and s3 layers are done in the background
  • Hashing of the sizing operations to find already sized images
  • Redisdb is used for storing the bucket information of images sized

Deployment

A Dockerfile is packaged with the project that includes a custom build of ImageMagick 6.9 with the latest libjpeg-turbo and libpng.

We use github.com/siddontang/ledisdb in production instead of redisdb. It's an Redis-API compatible engine that is designed for long-term persistence of the data set.. pretty much Redis on LevelDB.

Other

  • Imgry and its sizing operations can be used as a library, without the API server
  • Imgry supports pluggable image processing engines, but for now comes packaged with an ImageMagick engine by default (imgry/imagick)

License

MIT License (See LICENSE file)

More Repositories

1

goose

A database migration tool. Supports SQL migrations and Go functions.
Go
5,147
star
2

sup

Super simple deployment tool - think of it like 'make' for a network of servers
Go
2,455
star
3

scene-router

A complete scene routing library for react native
JavaScript
149
star
4

chainstore

Lightweight key-value interface to a bunch of storage engines with middleware support, organized as a chain of operations; written in Go
Go
130
star
5

NULevelDB

Objective-C interface to Google's LevelDB key/value embedded database
Objective-C
97
star
6

subexec

Subexec spawns n subprocess with an optional timeout
Ruby
63
star
7

react-native-radio-button-classic

Bring classic radio button to React-Native
Objective-C
48
star
8

uber-s3

Ruby S3 client with synchronous and asynchronous I/O adapters
Ruby
40
star
9

screenshot-nodejs

Screenshot as a service: GoogleChrome/puppeteer Node.js REST API server + Golang client
TypeScript
37
star
10

saml

SAML provides tools for SAML based single sign-on in Go
Go
27
star
11

lg

[DEPRECATED] we switched to github.com/rs/zerolog
Go
22
star
12

react-transact

Simple, effortless way to fetch data and make them available to React components.
JavaScript
19
star
13

react-native-nurse

run react-native on simulators without opening xcode and android avd
Shell
15
star
14

qmd

[DEPRECATED] Async script processing web service
Go
11
star
15

screenshot

Screenshot: Take screenshots with ease from any language
Go
10
star
16

logspout-s3

[NOT MAINTAINED] Logspout Adapter for AWS S3 to send docker logs to S3 - ready for Athena
Go
7
star
17

warpdrive

In-App upgrade service for React-Native! Supporting iOS and Android apps.
Go
7
star
18

docker-ledisdb

Dockerfile for Ledisdb with Rocksdb support
6
star
19

goico

Go ICO image decoder
Go
5
star
20

kube-deploy

Dockerfile
1
star
21

metrixjs

Pressly Metrix JS tracker
JavaScript
1
star