height or if width < height // if so it adjusts accordingly to make sure the image // stays smaller then the $newWidth and $newHeight $ratioWidth = $srcWidth/$newWidth; $ratioHeight = $srcHeight/$newHeight; if( $ratioWidth < $ratioHeight){ $destWidth = $srcWidth/$ratioHeight; $destHeight = $newHeight; }else{ $destWidth = $newWidth; $destHeight = $srcHeight/$ratioWidth; } $destImage = ImageCreateTrueColor( $destWidth, $destHeight); ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ); ImageJPEG( $destImage,"",75 ); ImageDestroy( $srcImage ); ImageDestroy( $destImage ); } /** * Close MySql non-persistent connections */ if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) { @mysql_close($GLOBALS['dbh']); } if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) { @mysql_close($GLOBALS['userlink']); } ?>