stefan
stefan

Reputation: 33

Rest Server Codeigniter return image data

maybe someone can help me: i'm using the rest server from here: https://github.com/philsturgeon/codeigniter-restserver. what i try to do is to return an image from our server. did anyone have experience with that ?

case could be this: app is using the rest api and wants to get an user image, which should not be directly accessible through a url...

kind regards, Stefan

Upvotes: 3

Views: 2447

Answers (1)

Phil Sturgeon
Phil Sturgeon

Reputation: 30766

Don't be scared to use PHP here:

header('Content-Type: image/jpg');
echo $image;

You only need to use $this->response() if you want to send it an array to automatically deal with. Spitting out images is simple.

Upvotes: 2

Related Questions