The error is exactly what it says - something in your code has caused output to be performed, which kills the header()
call, preventing the content-type from being set. In the absence of any valid content-type header, the client browser assumes text/plain, and is showing your JPEG image - as raw "garbage".
You need to figure out WHERE in your code that output is being performed (I'm willing to bet a shiny penny it's in that get_image()
function, and eliminate it.