<?  //多角度图片插入 /*小图*/
						$select_sql2 = "select max(id) from ls_products";
						$select_query2 = $opendb->query($select_sql2);
						$select_rows2 = mysql_fetch_assoc($select_query2);
						$productID = $select_rows2['max(id)'];   //最后更新的产品ID
						$proTitle = "产品主图片";
						$insert_sql = sprintf("insert into ls_propic (productID,picName,picPath,thumbPicPath,num,proTitle,enable) values (%s,%s,%s,%s,%s,%s,%s) ", GetSQLValueString($productID, "int"), GetSQLValueString($productPic, "text"), GetSQLValueString($bigPicPath, "text"), GetSQLValueString($thumbPicPath, "text"), GetSQLValueString(0, "int"), GetSQLValueString($proTitle, "text"), GetSQLValueString("1", "int")
						);
						$insert_query = $opendb->query($insert_sql);
						

							//生成其他局部图、缩略图，并存入数据库

						for ($i = 0; $i < count($_FILES['showPic']['name']); $i++) {
								$image = $_FILES['showPic']['name'][$i];
								$size = $_FILES['showPic']['size'][$i];
								$type = $_FILES['showPic']['type'][$i];
								$text = $_POST['text'][$i];

								if ($text == null) {
									$text = "ls";
								}
								if ($type == "image/gif" || $type == "image/png" || $type == "image/x-png" || $type == "image/pjpeg" || $type == "image/jpeg") {
									if ($size < $PicSize) {
										$select_sql2 = "select max(id) from ls_products";
										$select_query2 = $opendb->query($select_sql2);
										$select_rows2 = mysql_fetch_assoc($select_query2);
										$productID = $select_rows2['max(id)'];   //最后更新的产品ID
										$pathBigPic = $pathFoldersProducts . "/" . $newBigFoldersProducts;
										createFolder($pathBigPic);	    //创建图片上传目录
										$pathSmallPic = $pathFoldersProducts . "/" . $newSmallFoldersProducts;
										createFolder($pathSmallPic);	  //创建小图文件夹
										$pathPagePic = $pathFoldersProducts . "/" . $showproductsFolders;
										createFolder($pathPagePic);	  //创建大图浏览（.htm）文件夹
										$arr = array(" ", ".");
										$productPic = str_replace($arr, "", time()) . $i . "." . substr($image, -3);
										$pathBigPic = $pathBigPic . "/" . $productPic;
										move_uploaded_file($_FILES['showPic']['tmp_name'][$i], $pathBigPic);
										chmod($pathBigPic, 0644);
										$toW =$BigPicW;    //宽度;
										$toH =$BigPicH;    //高度;
										$toFile = $pathBigPic; //目标地址
										$srcFile = $pathBigPic; //目标地址
										ImageResize($srcFile, $toW, $toH, $toFile); //resize the big pic width & height to stand size
										chmod($toFile, 0644);
										$srcFile = $pathBigPic; //源地址
										$toW = $SmallPicW;   //宽度
										$toH = $SmallPicH;   //高度
										$toFile = $pathSmallPic . "/" . $productPic; //目标地址
										$thumbPicPath = $toFile;
										ImageResize($srcFile, $toW, $toH, $toFile);
										chmod($toFile, 0644);
										
										$insert_sql = sprintf("insert into ls_propic (productID,picName,picPath,thumbPicPath,num,proTitle,enable) values (%s,%s,%s,%s,%s,%s,%s) ", GetSQLValueString($productID, "int"), GetSQLValueString($productPic, "text"), GetSQLValueString($pathBigPic, "text"), GetSQLValueString($thumbPicPath, "text"), GetSQLValueString($i + 1, "int"), GetSQLValueString($text, "text"), GetSQLValueString("1", "int")
										);
										$insert_query = $opendb->query($insert_sql);
									}
								}

								//上传局部图片
								if ($i == 0) {
									for ($e = 0; $e < count($_FILES['partimages']['name']); $e++) {
									$image = $_FILES['partimages']['name'][$e];
									$size = $_FILES['partimages']['size'][$e];
									$type = $_FILES['partimages']['type'][$e];
									$partText = $_POST['partText'][$e];
									$partText == null ? $partText = "ls" : $partText = $partText;
									if ($type == "image/gif" || $type == "image/png" || $type == "image/x-png" || $type == "image/pjpeg" || $type == "image/jpeg") {
										if ($size < $PicSize) {
											$id = $_POST['id'];
											$select_sql2 = "select * from ls_propic where productID='" . $productID . "' && num='0' ";
											$result = $opendb->query($select_sql2);
											$rows = mysql_fetch_assoc($result);
											$picname = $rows['picName'];   //最后更新的图片名称
											$pathBigPic = $pathFoldersProducts . "/" . $partImagesFolders;
											createFolder($pathBigPic);	    //创建图片上传目录
											$arr = array(" ", ".");
											$productPic = str_replace($arr, "", time()) . $e . "." . substr($image, -3);
											$pathBigPic = $pathBigPic . "/" . $productPic;
											move_uploaded_file($_FILES['partimages']['tmp_name'][$e], $pathBigPic);
											chmod($pathBigPic, 0644);
											$toW = 100;   //宽度
											$toH = 100;   //高度
											$toFile = $pathBigPic; //目标地址
											$srcFile = $pathBigPic; //源地址
											ImageResize($srcFile, $toW, $toH, $toFile);
											chmod($toFile, 0644);
											$insert_sql = sprintf("INSERT INTO partimages (`bigimage`, `partImages`, `partImagesPath`, `num`, `describe`, `enable`) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($picname, "text"), GetSQLValueString($productPic, "text"), GetSQLValueString($pathBigPic, "text"), GetSQLValueString($e, "int"), GetSQLValueString($partText, "text"), GetSQLValueString("1", "int")
											);
											$insert_query = $opendb->query($insert_sql);
										}
								   }
								   }
								}
						}
							
						/*小图*/
?>
