I want to display images, from files, in an HTML webpage, using PHP to hide the location of the files, using PHP header/readfile, and avoiding any PHP that would reveal the file location (such as echo).
So far I've only been able to get this working by calling a PHP scrpit from the HTML, but would prefer to do so without calling a script, so a viewer has no sight of the PHP script file. I do not want to use a PHP file rather than HTML file (so a viewer couldn't type the URL of the PHP script in themselves).
image.php:
<?php
header('Content-Type:image/jpeg');
readfile('../image.jpg');
?>
image.html:
<html>
...
<img src="image.php"/>
In the HTML file I would like to do the equivalent but in-line:
<html>
...
<img src="<?php header('Content-Type:image/jpeg');readfile('../image.jpg');?>"/>
Or:
<html>
...
<?php
echo '<img src="';
header('Content-Type:image/jpeg');
readfile('../image.jpg');
echo '"/>';
?>
I suspect my lack of understanding of how HTML and PHP work together is letting me down here.