Copy CodeThe code is as follows:
Header ("CONTENT-TYPE:TEXT/HTML;CHARSET=GBK");
Ini_set ("Date.timezone", "Asia/chong");
Determine if the file is empty
if (empty ($_files)) {
echo "Upload file too large";
Exit
}
Determine if the file upload has errors
if ($_files[' pic ' [' ERROR ']) {
echo "Upload file";
Exit
}
Determine if the file type is illegally getting the file suffix
$allowtype =array ("JPG", "PNG", "JPEG", "gif");
$a =explode ('. ', $_files[' pic ' [' name ']);
$index =count ($a)-1;
$ex =strtolower ($a [$index]);
if (!in_array ($ex, $allowtype)) {
echo "Illegal uploading of files";
Exit
}
$file =date (' Ymdhis '). Rand (). ".". $ex;
$SRC =$_files[' pic ' [' tmp_name '];
$des = "upload/". $file;
$rs =move_uploaded_file ($SRC, $des);
Thumbnail images
Read uploaded images
$image =imagecreatefromjpeg ($des);
$a =getimagesize ($des);
$w = $a [0];
$h = $a [1];
if ($w > $h) {
$width = 300;
$height = $width/$w * $H;
}else if ($w < $h) {
$height = 300;
$width = $height/$h * $W;
}else{
$width = 300;
$height = 300;
} www.jbxue.com
Create a blank new picture
$newimage =imagecreatetruecolor ($width, $height);
Copy source picture content copy new picture
Imagecopyresized ($newimage, $image, 0,0, 0,0, $width, $height, $w, $h);
$filename = "Upload/s_". $file;
Imagejpeg ($newimage, $filename);
http://www.bkjia.com/PHPjc/718620.html www.bkjia.com true http://www.bkjia.com/PHPjc/718620.html techarticle Copy the code as follows: Form method= "POST" action= "suo_do.php" enctype= "multipart/form-data" input type= "file" name= "pic"/input Type= "Submit" value= "Upload 1"//form? PHP head ...