Ok, I have a very weird problem here. I want to use .php to create
thumbnails. For this, I use the following code:
<?
$file = isset($_GET['file']) ? $_GET['file'] : exit;
//Load the image
$src = imagecreatefromjpeg($file);
if($src)
{
$width = ImageSx($src);
$height = ImageSy($src);
$maxwidth = 140;
$maxheight = $maxwidth / 1.333333;
if($width > $height / 1.333333)
{
$newwidth = $maxwidth;
$newheight = $height / ($width / $newwidth);
} else {
$newheight = $maxheight;
$newwidth = $width / ($height / $newheight);
}
$dest = ImageCreate($newwidth, $newheight);
ImageCopyResized($dest, $src, 0, 0, 0, 0, $newwidth, $newheight, $width,
$height);
header("Content-Type: image/jpg");
Imagejpeg($dest);
exit;
}
?>
This file is called showthumb.php. Now in my C:\inetpub\wwwroot\ directory
(Yes, im doing this all under windows) I create a file called test.html
(after having some trouble, but this will explain the problem). I put the
following data in this test.html:
<img src=http://localhost/showthumb.php?file=pic.jpg>
(where pic.jpg was a valid .jpg file inside the C:\inetpub\wwwroot\
directory)
I opened this file in internet explorer by going to
C:\inetpub\wwwroot\test.html. It worked, the image got displayed (although
the colors where screwed up, but that i might be able to fix that myself). I
went to http://localhost/test.html (Thus the same .html file) and it did not
display the image! It just kept loading without actually doing anything. I
tried the same in Mozilla Firebird... Not a single problem. both
C:\inetpub\wwwroot\test.html and http://localhost/test.html showed the
picture as expected.
Now: What's wrong? How can I fix this crap?
Thanks