Add photo.to_json & leverage it in the frontend.

Add a proper to_json method to the photo model that generates a JSON
blob which can be trivially consumed in a knockout ViewModel.  Cleans up
some ugly JS variable creations in the template.