imbo/imbo — pull request #161 by christeredvartsen (2013-12-18 10:24:53+00:00)
Title: Use POST on the images resource to add new images

Today Imbo uses PUT on an image URI to create the image. When Imbo has event listeners that modify the image before storing it, this does not adhere to [RFC2616 section 9.6](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6), as it states:

> In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.

Imbo currently does not send 301, but includes the correct imageIdentifier in the response data.

If we were to change Imbo to instead use POST on the images resource we are free to store the image under whatever imageIdentifier we see fit. This also removes the requirement of using MD5 sums for resource identifiers.

There might be an issue when using imagick/GD/whatever functions that is not deterministic. This could potentially generate different image identifiers for the same image (if we keep using the MD5 sum of the resulting image as the identifier), causing Imbo to store the same image over and over when the same image is POST'ed.

Thoughts?