if(isset($_POST[\'submit\'])){
if (isset ($_FILES[\'new_image\'])){
$imagename = $_FILES[\'new_image\'][\'name\'];
$source = $_FILES[\'new_image\'][\'tmp_name\'];
$target = \"images/\".$imagename;
move_uploaded_file($source, $target);
$imagepath = $imagename;
$save = \"images/\" . $imagepath; //This is the new file you saving
$file = \"images/\" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 500;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
/*
$save = \"images/sml_\" . $imagepath; //This is the new file you saving
$file = \"images/\" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 80;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ; */
echo \"Large image:  \";
//echo \"Thumbnail: \";
}
}
?>
|