fix outputing image to the browser before the content type header is sen...

# The problem
The captcha image was sometimes sent with a `text/html` header and sometimes with its appropriate `image/jpeg` header.

# The explanation
The imagejpg() function actually returns a boolen value and the image itself is sent to the output buffer. So when passed as a parameter to `$this->response->body(imagejpeg($image));` the image is not set as the body of the response.

# The fix
Capture the output buffer content into a variable which then is passed as the body of the response.