Fix redundant SQL query on contact photo request after photo upload.
The query was also invalid in case of uploading photo in contact create form.
Move contact photo handling from show.inc into a separate file.