I want to obtain images from the server.
The html code :
<div id='container'></div>
Here is my code in jquery :
$.post('php/Image.php', function(data) {
$('#container').html(data);
});
And the php code :
header('Content-Type: image/png');
$img = imagecreatefrompng("image.png");
imagepng($img);
On my web page I can see the “binary” of the image and that’s not what I expect. Somebody can tell me what I’m doing wrong ? Or if there is a better solution to do that.
Thanks in advance for your help.
You don’t need to request the image body itself, but insert an
imgtag with link to it: