diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ae121a1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2013 Google. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..20f95cb --- /dev/null +++ b/readme.md @@ -0,0 +1,56 @@ +# 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]. Photon is a great free service, but is +limited to sites hosted on WordPress.com, or that use the [Jetpack +plugin][jetpack]. 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. + +[photon]: http://developer.wordpress.com/docs/photon/ +[jetpack]: http://jetpack.me/ +[resize.ly]: https://resize.ly/ +[embed.ly]: http://embed.ly/display +[cloudinary]: http://cloudinary.com/ + + +## 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. + +[optimize caching]: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ + + +## License ## + +This application is distributed under the BSD-style license found in the +[LICENSE](./LICENSE) file.