Attempting to resize an image to a fixed width in pixels but it's working in percentage at the moment......I need to create a thumbnail with a width of 120 while keeping the image proportional.
<?
$save = '../images/userpics/thumbs/'.$NewImageName.'';
$file = '../images/userpics/'.$NewImageName.'';
$size = 0.45;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($file) ;
$modwidth = $width * $size;
$modheight = $height * $size;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 85) ;
?>