Ported in code from Parse anypic example app