user2088700
user2088700

Reputation: 21

Display images stored in a database without using header

I like the photo that I keep stored in my view using the following code but the problem is I can not play because I need the header('Content-Type: image/jpeg'); implementation would then display., But I have orders sure before header('Content-Type: image/jpeg'); What should I do to display images with no header.

Upvotes: 2

Views: 387

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324810

If you're only outputting the image, then it doesn't matter if you have other PHP instructions before it since the only output should be the image.

If you are trying to output an image directly into an HTML document, consider using a data URI:

<img src="data:image/jpeg;base64,<?php echo base64_encode($imagedata); ?>" />

Upvotes: 2

Related Questions