refactoring, moved all server side photo manipulation code into the photo library