I'm getting an error 255 when using a simple thumbnail script that uses the netPBM libraries. I've included sample code below. I call the function after a user has uploaded a file. The file itself gets uploaded with no problem. However, when this function is called a "0" byte thumbnail file is created w/an error 255 coming back from the system command. I've verified that the all the paths are correct. Any help is appreciated!
function create_thumbnail($filename) {
$netpbm_path = '/hsphere/local/home/root/netpbm/';
// Define where to find the various external binaries we need
$jpegtopnm = $netpbm_path."jpegtopnm"; // decompresses a jpeg to ppm
$ppmtojpeg = $netpbm_path."ppmtojpeg"; // compreses a ppm to jpeg
$pnmscale = $netpbm_path."pnmscale"; // scales a ppm image
$giftopnm = $netpbm_path."giftopnm"; // convert a gif to ppm
$ppmtogif = $netpbm_path."ppmtogif"; // convert a ppm to gif
$ppmquant = $server_path."ppmquant"; // colour quantize a ppm
// thumbnail file
$tfile = substr($filename,0,strlen($filename)-4) . '_thumb.'.substr($filename,strlen($filename)-3,3);
if(ereg("\.gif$",$filename)) { // Look for .gif extension
system("$giftopnm $filename | $pnmscale -xysize 150 150 | $ppmquant 256 | $ppmtogif > $tfile",$retval);
echo $retval;
} elseif(ereg("\.jpe?g",$filename)) { // Look for .jpg or .jpeg
system("$jpegtopnm $filename | $pnmscale -xysize 150 150 | $ppmtojpeg > $tfile",$retval);
echo $retval;
} else { /* not a GIF or JPG file */
$error = 'Please upload only .jpg or .gif files!';
header('Location: editphoto.php?error='.$error);
exit;
}
}