Hello,
Any ideas why the following code works in isolation (ie, a php file with nothing else in it) but when I drop it into my web page the image is displayed as 1,000's of letters and strange characters:
<?
header ("Content-type: image/png");
// Define the background image
$background = imagecreatefromjpeg("image1.jpg");
// Define the overlay image
$insert = imagecreatefrompng("trans.png");
// Select the first pixel of the overlay image (at 0,0) and use
// it's color to define the transparent color
imagecolortransparent($insert,imagecolorat($insert,0,0));
// Get overlay image width and height
$insert_x = imagesx($insert);
$insert_y = imagesy($insert);
// Combine the images into a single output image.
imagecopymerge($background,$insert,0,50,0,0,$insert_x,$insert_y,25);
// Output the results as a png image.
imagepng($background,"",50);
?>
In the version that doesn't work I have all the code at the top of my page except the imagepng command, that is in a table at the point on the page I want the image displaying.
I do not have any other graphics on the page (ie. jpg's) and I was led to believe the imagepng could be anywhere in the code.
Thanks for any help.