I don't understand what is going on with a simple example I created to 
understand how GD graphics are presented in a web page.

First I created the following simple script (in a file named graphic.php):

// file: graphic.php
<?php
$image = imagecreatefrompng("my_graphic.png");
imagepng($image);
?>

I load that script with my web browser, the image is displayed as expected.

Now if I treat graphic.php as an image, and reference in another page using 
the <img src=graphic.php> tag as in the following:

// my_page.php
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<img src=graphic.php>
</body>
</html>

The page again displays my_graphic.png.

However if I replace:
<img src=graphic.php>

with

<img src=<?php
$image = imagecreatefrompng("my_graphic.png");
imagepng($image);
?> >

my_graphic.png is no longer displayed and the web page gets filled with 
random characters.

Why is this happening or what am I missing.

Thanks for any insight.

Chris 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to