so i've written my image upload script which works just fine, but for some reason, i'm having trouble creating the thumbnails. as it stands right now, the script will create the thumbnail file, but it is an empty file (0 k) - so it creates the file but writes no data to it.
if anyone can shed some light as to what i'm missing, i would appreciate it.
thanks...
[php]<? if (!$_POST["submit"]) { ?>
<html>
<head></head>
<body>
<form action="<? echo $PHP_SELF; ?>" method="post" name="form" enctype="multipart/form-data">
<input type="file" name="img" />
<input type="submit" name="submit" value="upload" />
</form>
</body>
</html>
<?
} else {
$dir = "/gallery/albums/";
$file = $dir . $_FILES["img"]["name"];
$thumb = $dir . "th_" . $_FILES["img"]["name"];
$netpbm = "/gallery/netpbm/";
$new_w = 200;
$new_h = 200;
$topnm = "jpegtopnm";
$tothumb = "ppmtojpeg";
if ($_FILES["img"]["type"] == "image/jpeg")
{
move_uploaded_file($_FILES["img"]["tmp_name"], $file);
$cmd = $netpbm . $topnm . " \"" . $file . "\" | ";
$cmd .= $netpbm . "pnmscale -xysize " . $new_w . " " . $new_h . " | ";
$cmd .= $netpbm . $tothumb . " > \"" . $thumb . "\"";
exec($cmd);
}
else
{
echo "not a jpg";
}
}
?>[/php]