this script generates a jpg image.
That might sound like an obvious statement, but think about it for a while. It generates the "stuff" that goes into a jpg file.
This means that if you took the output from this script, saved it as a file.jpg, and openend it in paint shop pro, it would be a jpg image.
Now, consider how images are put into HTML pages. Do you have to open an image in notepad and look at all the funny letters and characters, copy them and then paste them into HTML? No. You do not.
What you do is link to the jpg image using the <img> codes. And that's exactly what you do here.
Except you dont link to a jpg, you link to the php file which generates the jpg.
So all you need to do is have a line in your php code which is akin to:
echo "<img src=\"makeimage.php?max_width=50&max_height=50\">";
This is why I gave you the code with $file in it, and you should leave it like that. By changing the $file to apache.jpg you make it so that the file can create only one jpg - if that's the case, then you might as well just resize the image yourself and put it in there. the line should read:
echo "<img src=\"makeimage.php?max_width=50&max_height=50&file=apache.jpg\">";
and you should change that line back to $file. Also note that this was written when i used global variables. You really should change all those to $_GET[''] variables, but worry about that later if i were you.
Also, you cant have a gif and just give it a jpg extension and expect this file (or any image browser) to know what to do. They use completely different compression methods which are totally incompatible: it's like saying "my brother is fluent in french and german, so I gave him some spanish (on the front of which i'd written "this is french") and asked him to translate it into german, but he couldnt. Why not?" Also gif's arent supported by the gd due to licensing and copyright.