0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00
A caching, resizing image proxy written in Go
Find a file
2013-11-27 14:45:46 -08:00
proxy add initial (pretty naive) server implementation 2013-11-27 14:45:46 -08:00
.gitignore parse http requests to image requests 2013-11-27 11:13:54 -08:00
imageproxy.go add initial (pretty naive) server implementation 2013-11-27 14:45:46 -08:00
LICENSE initial readme and license 2013-11-27 08:42:33 -08:00
readme.md initial readme and license 2013-11-27 08:42:33 -08:00

go-imageproxy

go-imageproxy is a caching image proxy server written in golang. It supports dynamic image resizing and URL whitelisting.

This project was inspired by, and is designed to be an alternative to, WordPress's photon service. Photon is a great free service, but is limited to sites hosted on WordPress.com, or that use the Jetpack plugin. If you don't want to use Jetpack, then you're asked to use a different service. If you're looking for an alternative hosted service, I'd recommend resize.ly, embed.ly, or cloudinary. I decided to try building my own for fun.

URL Structure

go-imageproxy URLs are of the form http://localhost/{options}/{remote_url}.

Options

Currently, the options path segment follows the same structure as resize.ly. You can specify:

  • square crop - one number, which is used as both the height and width. (example: 500)
  • rectangular crop - two numbers, separated by an 'x', resizes to the exact dimensions (width listed first). (example: 250x125)
  • auto height (preserves aspect ratio) - one number to the left of the 'x', resizes to a specific width, adjusting the height to preserve the aspect ration (example: 160x)
  • auto width (preserves aspect ratio) - one number to the right of the 'x', resizes to a specific height, adjusting the width to preserve the aspect ration (example: x200)

Remote URL

The URL of the original image to load is specified as the remainder of the path, without any encoding. For example, http://localhost/200/https://willnorris.com/logo.jpg.

In order to optimize caching, it is recommended that URLs not contain query strings.

License

This application is distributed under the BSD-style license found in the LICENSE file.