wiz126
Feb 16th, 2007, 12:10 PM
Ok the php code works perfectly fine on its on. Once I place it in an HTML page, It not longer works. How do I intergrade the code into my html page to make it work? (Do I need to have another header?)
When I Use This Code:
<html>
<head>
<title>This Is A Test</title>
</head>
<body>
<?php
$im = imagecreate(160, 160);
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagechar($im, 2, 0, 0, 'T', $black);
imagechar($im, 2, 10, 10, 'H', $black);
imagechar($im, 2, 20, 20, 'I', $black);
imagechar($im, 2, 30, 30, 'S', $black);
imagechar($im, 2, 40, 60, 'I', $black);
imagechar($im, 2, 50, 70, 'S', $black);
imagechar($im, 2, 60, 100, 'A', $black);
imagechar($im, 2, 70, 120, 'T', $black);
imagechar($im, 2, 80, 130, 'E', $black);
imagechar($im, 2, 90, 140, 'S', $black);
imagechar($im, 2, 100, 150, 'T', $black);
header('Content-type: image/png');
imagepng($im);
?>
</body>
</html>
I Get This:
<html>
<head>
<title>This Is A Test</title>
</head>
<body>
PNG
IHDR * * n PLTE U~ IDATx햻
EO bQN^BS <1q$]~R'D` $XI=(Im 3IbJYx.J
`L#AXRxzcIR.M{
Ig']qQb%>8ʟY$x IENDB`
</body>
</html>
When I Use This Code:
<html>
<head>
<title>This Is A Test</title>
</head>
<body>
<?php
$im = imagecreate(160, 160);
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagechar($im, 2, 0, 0, 'T', $black);
imagechar($im, 2, 10, 10, 'H', $black);
imagechar($im, 2, 20, 20, 'I', $black);
imagechar($im, 2, 30, 30, 'S', $black);
imagechar($im, 2, 40, 60, 'I', $black);
imagechar($im, 2, 50, 70, 'S', $black);
imagechar($im, 2, 60, 100, 'A', $black);
imagechar($im, 2, 70, 120, 'T', $black);
imagechar($im, 2, 80, 130, 'E', $black);
imagechar($im, 2, 90, 140, 'S', $black);
imagechar($im, 2, 100, 150, 'T', $black);
header('Content-type: image/png');
imagepng($im);
?>
</body>
</html>
I Get This:
<html>
<head>
<title>This Is A Test</title>
</head>
<body>
PNG
IHDR * * n PLTE U~ IDATx햻
EO bQN^BS <1q$]~R'D` $XI=(Im 3IbJYx.J
`L#AXRxzcIR.M{
Ig']qQb%>8ʟY$x IENDB`
</body>
</html>