Added optional logging for image HTTP requests, responses and errors.