The following code fails where i have highlighted it in red, please help.
<?php
include ("constants.inc");
$thumbw=100; //The Width Of The Thumbnails $nw
$thumbh=75; //The Height Of The Thumbnails $nh
$imagepath = "/shop/admin/images/";
$thumbpath = "/shop/admin/images/thumbs";
if ( $_FILES['image'] ['name'] != "")
{
$uploadedFile = $FILES['image']['tmp_name'];
$newFile = $SERVER['DOCUMENT_ROOT'].$GLOBALS['imagepath'].$FILES['image']['name'];
$newtempfile = $SERVER['DOCUMENT_ROOT'].$GLOBALS['thumbpath'].$_FILES['image']['name'];
}
echo('got here 1');
$image = $_FILES['image']['name'];
echo('got here 1.2');
$dimensions = GetImageSize($image); //$img
echo('got here 1.3');
$thname = "$thumbpath/$img_name";
echo('got here 1.5');
$width=$dimensions[0]; //$w
$height=$dimensions[1]; //$h
echo('got here 1.7');
$tempimage = ImageCreateFromJpeg($image);
echo('got here 1.8');
$thumb=ImageCreateTrueColor($thumbw,$thumbh);
echo('got here 1.9');
$wm = $width/$thumbw;
$hm = $height/$thumbh;
echo('got here 2');
$h_height = $thumbh/2;
$w_height = $thumbw/2;
move_uploaded_file($uploadedFile, $newFile);
echo('got here 3');
if($width > $height){
$adjusted_width = $width / $hm;
$half_width = $adjusted_width / 2;
$int_width = $half_width - $w_height;
ImageCopyResampled($thumb,$tempimage,-$int_width,0,0,0,$adjusted_width,$thumbh,$width,$height);
ImageJPEG($thumb,$thname,95);
echo('got here 4');
}elseif(($width < $height) || ($width == $height)){
$adjusted_height = $height / $wm;
$half_height = $adjusted_height / 2;
$int_height = $half_height - $h_height;
ImageCopyResampled($thumb,$tempimage,0,-$int_height,0,0,$thumbw,$adjusted_height,$width,$height);
ImageJPEG($thumb,$thname,95);
echo('got here 5');
}else{
ImageCopyResampled($thumb,$tempimage,0,0,0,0,$thumbw,$thumbh,$width,$height);
ImageJPEG($thumb,$thname,95);
echo('got here 6');
}
move_uploaded_file($thumb, $newthumbfile);
echo('got here 7');
imagedestroy($tempimage);
echo('got here 8');
?>