The following piece of script to get the width and height of a GIF file works perfectly.
use GD;
$file = "$html_root/file1.gif";
open (IMAGE, $file) || &sys_error("Can't open $file: $!");
$im = newFromGif GD::Image(IMAGE) || &sys_error("Can't create image from $file: $!");
close IMAGE;
($im_width,$im_height) = $im->getBounds();
However, when I tried to use the following script to get the width and height of a JPEG file, I got a "Premature End of Script Header" server error.
Does anyone know what is wrong with this script?
use GD;
$file = "$html_root/file2.jpg";
open (IMAGE, $file) || &sys_error("Can't open $file: $!");
$im = newFromJpeg GD::Image(IMAGE) || &sys_error("Can't create image from $file: $!");
close IMAGE;
($im_width,$im_height) = $im->getBounds();