Hey people,
im not sure where im going wrong with this script but could someone please point out any obvious mistakes because I just don't get why its not working :S
$Eimage = $HTTP_POST_FILES['Thumbnail']['tmp_name'];
$Emax_width = 800;
$Emax_height = 600;
$Esize = GetImageSize($Eimage);
$Ewidth = $Esize[0];
$Eheight = $Esize[1];
$Ex_ratio = $Emax_width / $Ewidth;
$Ey_ratio = $Emax_height / $Eheight;
if ( ($Ewidth <= $Emax_width) && ($Eheight <= $Emax_height) ) {
$Etn_width = $Ewidth;
$Etn_height = $Eheight;
}
else if (($Ex_ratio * $Eheight) < $Emax_height) {
$Etn_height = ceil($Ex_ratio * $Eheight);
$Etn_width = $Emax_width;
}
else {
$Etn_width = ceil($Ey_ratio * $Ewidth);
$Etn_height = $Emax_height;
}
$Esrc = gdImageCreateFromJpeg("$Eimage");
$Edst = gdImageCreateTrueColor($Etn_width,$Etn_height);
gdImageCopyResized($Edst, $Esrc, 0, 0, 0, 0,
$Etn_width,$Etn_height,$Ewidth,$Eheight);
gdImageJpeg($Edst, $Eimage, -1);
gdImageDestroy($Esrc);
gdImageDestroy($Edst);
thats the code i use for resizing the image which is uploaded using a simple upload form.
i get the error:
Fatal error: Call to undefined function: gdimagecreatefromjpeg()
I dont get why its saying its undefined when is says:
gdImageCreateFromJpeg("$Eimage");
Thanks for any help,