display image variable

2019-08-08 18:48发布

问题:

I have a php variable called $image which holds the contents of a medium blob from a mySQL server and I'm trying you output it using PHP5.

When I just use the code:

echo $image;

it just output a page full of ASCII characters. Does anyone have any suggestions? Thanks

回答1:

Specify the correct Content-Type header.

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


标签: php mysql mysqli