DIsplaying an Image
Posted: Sat Apr 10, 2004 12:53 pm
Hi,
I used the image functions in PHP to make an image. What I did was I made it a file called image.php. The text on the image is based on information submitted in a form.
In my other PHP document, show.php, i used html. Inside the html table, I placed <? include "image.php"; ?>
However, when I view show.php, all I see is a bunch of random code with a bunch of different foregn letters inside the html table.
Why does it do this, and how would I display the image inside the table?
Could this have to do with destroying the image?
Normally if i vew Image.php it looks normal. THe image shows up perfect!
Here is the code for image.php :
I used the image functions in PHP to make an image. What I did was I made it a file called image.php. The text on the image is based on information submitted in a form.
In my other PHP document, show.php, i used html. Inside the html table, I placed <? include "image.php"; ?>
However, when I view show.php, all I see is a bunch of random code with a bunch of different foregn letters inside the html table.
Why does it do this, and how would I display the image inside the table?
Could this have to do with destroying the image?
Normally if i vew Image.php it looks normal. THe image shows up perfect!
Here is the code for image.php :
Code: Select all
<?php
header("Content-type: image/png");
$im = imagecreatefrompng("path/to/imgae");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, $ccї0], $ccї1], $ccї2]);
imagettftext($im, $companysize, 0, 70, 40, $text_color, $companyfont,
$companytext);
imagepng($im);
imagedestroy($im);
?>