WHOA! Sorry, this is my mistake. I didn't copy the entire code, it's missing a few vital lines at the bottom. The code should be
// Image Scaling Hack!!
list($width_orig, $height_orig) = getimagesize($uploadfile);
if( $width_orig > 800 || $height_orig > 800 ) {
$width = 800;
$height = 800;
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($uploadfile);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, $uploadfile, 100);
// End Image Scaling Hack