semirook / imgwizard

Simple server for On-the-Fly image processing in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is it?

ImgWizard is a small server written in Go as faster alternative for thumbor

What it can do?

  • Fetch image from local file system or remote media
  • Resize it
  • Crop it
  • Change quality
  • Cache resized image to file system and get it on next request
  • Return WebP images if browser supports it

How to use?

http://{server}/images/{storage}/{size}/{path_to_file}

  • server - imgwizard server addr
  • mark - mark for url (can be used for nginx proxying)
  • storage - "loc" (local file system) or "rem" (remote media)
  • size - "320x240" or "320x" or "x240"
  • path_to_file - path to original file (without "http://")
Example:

http://192.168.0.1:4444/images/rem/462x/media.google.com/uploads/images/1/test.jpg

How to install?

Installing libvips

VIPS is a free image processing system. Compared to similar libraries, VIPS is fast and does not need much memory, see the Speed and Memory Use page. As well as JPEG, TIFF, PNG and WebP images, it also supports scientific formats like FITS, OpenEXR, Matlab, Analyze, PFM, Radiance, OpenSlide and DICOM (via libMagick). (© vips wiki)

Mac OS

$ brew install vips

Debian based

$ sudo apt-get install libvips-dev

RedHat

Check this

Installing imgwizard

  • go get github.com/shifr/imgwizard
  • export PATH=$PATH:$GOPATH/bin if you haven't done it before

Running imgwizard

  • imgwizard - run server without restrictions

You will see "ImgWizard started..."

Check imgwizard work after server start

Parameters on start?

imgwizard -l localhost:9000 -c /tmp/my_cache_dir -m media1.com,media2.com -s 100x100,480x,x200 -q 80 -mark imgw -thumb /path_to_404_image.jpg

  • -l: Address to listen on (default - "localhost:8070")
  • -c: directory for cached files (default - "/tmp/imgwizard")
  • -m: comma separated list of allowed media (default - all enabled)
  • -s: comma separated list of allowed sizes (default - all enabled)
  • -q: resized image quality (default - 80)
  • -mark: mark (default - images)
  • -thumb: default image if requested doesn't exists (default - /tmp/404.jpg)

Plans?

Yes, a lot.

About

Simple server for On-the-Fly image processing in Go

License:MIT License


Languages

Language:Go 100.0%