I've seen a few cases of this online but every solution I try yields the same result. I have tried various versions of this same bit of code but I still am unable to display an image, either from the internet or from a folder.
My code looks like this:
<?php
$img = 'anything.jpg';
$getInfo = getimagesize($img);
header('Content-type: ' . $getInfo['mime']);
readfile($img);
?>
And then this in the appropriate spot in the html document:
<?php
echo "<img src ='$img'>";
?>
My output looks like this: (only it is about 100 lines long, covering most of the page)
„•J€m’¥Id„©,ƒð‹"È!dY*
d¨E„Œœ6TêÞ BTç–dáfδ§Ýfΰɾ,ÙÔÌxà5IõcÁ=£TM´® ‡iNt4ÖMYí;ÅU©ª’§ª7’Ê:¡ú§šß”,¾5™ˆ
The image displays after all this. I've been working at this quite a while now, any help would make a man's day.