GD header + AJAX not working out
Posted: Thu Jan 24, 2008 4:47 am
ok so i am trying to display a gd image in an ajax div. yet everytime i do ajax seems to take out the header??
GD
does anyone know how to solve this issue?
Code: Select all
<html>
<head>
<title>test</title>
</head>
<body>
<script>
function loadurl(dest) {
try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", dest);
xmlhttp.send(null);
}
function triggered() {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
document.getElementById("output").innerHTML = xmlhttp.responseText;
}
}
</script>
<body>
<div id="output" onclick="loadurl('http://www.majesticarpg.com/avatar3.php')">click here to load my GD image into this div</div>
</body>
</html>Code: Select all
<?php
header("Content-type: image/png");
$im = imagecreatefrompng("http://www.majesticarpg.com/paperdoll/1/body.png");
$im2 = imagecreatefrompng("http://www.majesticarpg.com/paperdoll/1/ears.png");
imagecolortransparent($im,imagecolorat($im,0,0));
imagecolortransparent($im2,imagecolorat($im2,0,0));
imagecopymerge($im,$im2,0,0,0,0,200,317,100);
imagepng($im);
imagedestroy($im);
?>