Git Product home page Git Product logo

imgry's Introduction

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)

imgry's People

Contributors

c2h5oh avatar pkieltyka avatar sebito91 avatar vojtechvitek avatar xiam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imgry's Issues

Fast gif resize

imgry/imagick/imagick.go

Lines 195 to 199 in f7a2a8c

// TODO: instead of Coalesce, better to change the offsets.
// This is required for animated image resizing
if !sz.Flatten && i.mw.GetNumberImages() > 1 {
i.mw = i.mw.CoalesceImages()
}

Documentation

Is it possible you can give some installation instruction and configuration options (how to use it with s3) etc.,

I have never used Go, but it this is like install on a server and forget, it would be great!

Docker image fails to build

This was with:

Docker version 1.9.1, build a34a1d5

The ADD command fails with an error, it's like it does not honour redirections properly.

Imagick reference is broken

Hey @pkieltyka, it looks like, with your latest commit, the github.com/gographics/imagick was updated to a reference that does not exist:

git diff a983e5c52dd277be3e78a150828fd4cf2805c6dd abd012e0f4c546fc0394e3ba1d1ccb24e32021d4

And now the make deps script fails:

# cd /home/vagrant/go/src/github.com/gographics/imagick; git checkout 5f86f7c1a891
error: pathspec '5f86f7c1a891' did not match any file(s) known to git.

Probably glock failed to sync dependencies for some reason?

Re-enable metricsmgr

Because github.com/pressly/chainstore/metricsmgr needed some changes and was temporary removed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.