$RESIZEHEIGHT = 100; $RESIZEWIDTH2 = 700; $RESIZEHEIGHT2 = 700; if ($ftype == "jpg" || $ftype == "JPG") { $im = imagecreatefromjpeg($destination); } else { $im = imagecreatefromgif($destination); } makexiao($im, $RESIZEWIDTH2, $RESIZEHEIGHT2, $destination, $ftype); imagedestroy($im); if ($ftype == "jpg" || $ftype == "JPG") { $im = imagecreatefromjpeg($destination); } else { $im = imagecreatefromgif($destination); } makexiao($im, $RESIZEWIDTH, $RESIZEHEIGHT, $filepath . "s_" . $savename . $ftype, $ftype); imagedestroy($im); $image_size = getimagesize($destination); //大图水开始 if ($watermark == 1) { $iinfo = getimagesize($destination, $iinfo); $nimage = imagecreatetruecolor($image_size[0], $image_size[1]); $white = imagecolorallocate($nimage, 255, 255, 255); $black = imagecolorallocate($nimage, 0, 0, 0); $red = imagecolorallocate($nimage, 255, 0, 0); imagefill($nimage, 0, 0, $white); switch ($iinfo[2]) { case 1: $simage = imagecreatefromgif($destination); break; case 2:
$pinfo = pathinfo($file["name"]); $ftype = $pinfo['extension']; $destination = $filepath . "b_" . $savename . $ftype; if (!move_uploaded_file($filename, $destination)) { callmsg("移动照片出错", "-1"); } $path_b = $dbpath . "b_" . $savename . $ftype; // 略 $RESIZEWIDTH2 = 700; $RESIZEHEIGHT2 = 700; if ($ftype == "jpg" || $ftype == "JPG") { $im = imagecreatefromjpeg($destination); } else { $im = imagecreatefromgif($destination); } makexiao($im, $RESIZEWIDTH2, $RESIZEHEIGHT2, $destination, $ftype); imagedestroy($im); $image_size = getimagesize($destination); //水 $iinfo = getimagesize($destination, $iinfo); $nimage = imagecreatetruecolor($image_size[0], $image_size[1]); $white = imagecolorallocate($nimage, 255, 255, 255); $black = imagecolorallocate($nimage, 0, 0, 0); $red = imagecolorallocate($nimage, 255, 0, 0); imagefill($nimage, 0, 0, $white); switch ($iinfo[2]) { case 1: $simage = imagecreatefromgif($destination); break; case 2: $simage = imagecreatefromjpeg($destination);
} } } $filepath = wrzc_net . "up/photo/" . date("y") . "/" . date("md") . "/"; mkpath($filepath); $dbpath = date("y") . "/" . date("md") . "/"; $filename = $cook_userid . "_" . cdstr(20) . ".jpg"; $destination = $filepath . "b_" . $filename; imagejpeg($img, $destination, 85); imagedestroy($img); $path_s = $dbpath . "s_" . $filename; $path_b = $dbpath . "b_" . $filename; $RESIZEWIDTH = 100; $RESIZEHEIGHT = 100; $im = imagecreatefromjpeg($destination); makexiao($im, $RESIZEWIDTH, $RESIZEHEIGHT, $filepath . 's_' . $filename); imagedestroy($im); $addtime = date("Y-m-d H:i:s"); $db->query("INSERT INTO " . __TBL_PHOTO__ . " (userid,path_s,path_b,title,addtime) VALUES ('{$cook_userid}','{$path_s}','{$path_b}','{$title}','{$addtime}')"); // $tmpid = $db->insert_id(); $rt = $db->query("SELECT a.userid,b.grade,b.if2 FROM " . __TBL_FRIEND__ . " a," . __TBL_MAIN__ . " b WHERE a.senduserid=" . $cook_userid . " AND a.userid=b.id AND a.ifagree=1"); $total = $db->num_rows($rt); if ($total > 0) { for ($i = 0; $i < $total; $i++) { $rows = $db->fetch_array($rt); if (!$rows) { break; } $uid = $rows[0]; $ugrade = $rows[1];