add image put endpoint to replace images over the API

PUT /:collection/:id/image/:image_id replaces the image with image_id.

Factors out the code common to the PUT and POST requests into functions
to reduce duplication.
API endpoint to delete individual images

DEL /:collection/:id/image/:image_id will remove that image and delete
the file on the server. This only works for images stored on the server
as remote images don't have IDs
delete all images API endpoint

DELETE /:collection/:id/image will remove all images associated with a
document and remove any image files on the server too