This is maybe looks stupid question. But I'm having trouble to print both image and string(s) in web page.
My codes:
<?php
$file = 'uploadedimages/' . end(end($collectedResult));
// $file='demo.gif';
if(file_exists($file)){
header('Content-Type:image/jpeg');
header('Content-Transfer-Encoding: base64');
// $data=base64_encode(file_get_contents($file));
// echo $data;
$im = imagecreatefromjpeg($file);
imagejpeg($im);
imagedestroy($im);
}
else
echo 'No such file';
header('Content-Type: text/html; charset=utf-8');
echo '<br><p>' . json_encode($collectedResult, JSON_UNESCAPED_UNICODE) . '</p>';
?>
With these codes image's showing in browser. It's OK. But some json strings
aren't showing.
I don't know where I should put the header('Content-Type: text/html; charset=utf-8');
and/or header('Content-Type:image/jpeg');
line(s).
Thanks.