Code for s3 photo viewer.