I was wondering if there was a way for a controller to, instead of returning a string, or a view, return an image (be it JPG, PNG etc). For example, instead of ending with a $t
An easier way with automatic mime-type.
$this->load->helper('file'); $image_path = '/path/to/image/file'; $this->output->set_content_type(get_mime_by_extension($image_path)); $this->output->set_output(file_get_contents($image_path));