Unique hashes

Added unique constraint for image hashes and updated error reporting for the users.

Fixed gif serving: gifs cannot be resized, only the original size can be served. 

Not resizing gifs is not a really good solution. We should look into resizing (animated) gifs and how it effects them.