$smarty->assign('authorAvatar', $rows['user_avatar'] == '' ? $defaultAvatar : $avatarPath . $rows['user_avatar']); } } //输出照片信息 if (!empty($albumId)) { $result = selectSql('photos', 'photo_id,photo_name,photo_desc', 'album_id=' . $albumId); if ($result['state'] === 1) { $photoInfoArr = array(); while ($rows = mysql_fetch_assoc($result['msg'])) { $pattern = "/(.+).(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF)\$/"; preg_match($pattern, $rows['photo_name'], $matches); $photoInfoArr[] = array('id' => $rows['photo_id'], 'name' => $matches[1], 'path' => $thumImgPath . '200_' . $matches[0], 'description' => $rows['photo_desc'], 'photoComments' => getComments($rows['photo_id'], $defaultAvatar, $avatarPath)); //新上传的图片生成缩略图 $srcFile = iconv('utf-8', 'gb2312', $uploadImgPath . $matches[0]); $dstFile = iconv('utf-8', 'gb2312', $thumImgPath . '200_' . $matches[0]); thumbnails($srcFile, $dstFile, 200, ''); } } $smarty->assign('photoInfoArr', $photoInfoArr); } $smarty->assign('userId', $userId); $smarty->assign('userName', $userName); $smarty->assign('albumId', $albumId); $smarty->assign('albumCover', $albumCover); $smarty->assign('cssFileName', 'photoList'); $smarty->display('photoList.tpl'); } if (!empty($_POST['albumId']) && !empty($_POST['act']) && $_POST['act'] == 'delAlbum') { $albumId = $_POST['albumId']; $result = selectSql('photos', 'photo_id', 'album_id=' . $albumId); if ($result['state'] == 1) {
function gallery() { global $version, $action, $oimgdir, $othumbdir, $imgdir_links, $thumbdir_links, $imgdir, $thumbdir; $othumbdir = dir($thumbdir); $oimgdir = dir($imgdir); switch ($action) { case "gallery": thumbnails(); break; case "full": fullsize(); break; default: thumbnails(); break; } //echo "<BR><BR><SMALL>Generated by " . "<A HREF=\"http://tuma.stc.cx/gallery.php\">photogallery script</A> {$version}.</SMALL></CENTER>"; $othumbdir->close(); $oimgdir->close(); }
<?php require 'public.php'; $nowUserId = $_GET['userId'] == '' ? $userId : $_GET['userId']; if (!empty($nowUserId)) { //获取相册信息 $result = selectSql('albums', 'album_id,album_name,album_cover', 'user_id=' . $nowUserId); if ($result['state'] == 1) { $albumInfoArr = array(); while ($rows = mysql_fetch_assoc($result['msg'])) { $srcFile = $rows['album_cover'] == '' ? getAlbumCover($rows['album_id'], $defaultAlbumCover, $uploadImgPath) : $uploadImgPath . $rows['album_cover']; $dstFile = $rows['album_cover'] == '' ? getAlbumCover($rows['album_id'], $defaultAlbumCover, $uploadImgPath) : $thumImgPath . '75_75_' . $rows['album_cover']; thumbnails(iconv('utf-8', 'gb2312', $srcFile), iconv('utf-8', 'gb2312', $dstFile), 75, 75); $albumInfoArr[] = array('id' => $rows['album_id'], 'name' => $rows['album_name'], 'cover' => $dstFile, 'photoNum' => getPhotoNum($rows['album_id'])); } } if ($nowUserId == $userId) { $smarty->assign('isAuthor', true); } //读取相册的拥有者 $result = selectSql('users', 'user_name,user_avatar', 'user_id=' . $nowUserId); if ($result['state'] == 1) { $rows = mysql_fetch_assoc($result['msg']); $smarty->assign('authorName', $rows['user_name']); $smarty->assign('authorAvatar', $rows['user_avatar'] == '' ? $defaultAvatar : $avatarPath . $rows['user_avatar']); } $smarty->assign('authorId', $nowUserId); $smarty->assign('userId', $userId); $smarty->assign('userName', $userName); $smarty->assign('albumInfoArr', $albumInfoArr); $smarty->assign('cssFileName', 'albumList');
</div> <div id="faceContainer"> <div class="container"> <div id="flipper"> <div><div id="hair"></div></div> <div><div id="eyes"></div></div> <div><div id="mouth"></div></div> </div> <div id="photoShot"></div> </div> </div> <!-- the list of thumbnails, generated by PHP --> <div id="thumbnails"><?php thumbnails(); ?> </div> <div id="controls"> <button class="invisible" id="setupSwf">Setup SWF</button> <button class="invisible" id="addPic">Add your picture</button> <button id="saveAs">Save to Hall of Shame</button><br> <p> <span class="cb"><input type="checkbox" id="random" name="random"> <label for="random">Rotate randomly</label></span> </p> </div> </div> </div>
$subRows = mysql_fetch_assoc($subResult['msg']); $friendName = $subRows['user_name']; } //朋友的所有相册 $friendPhotoInfoArr = array(); $subResult = selectSql('albums', 'album_id', 'user_id=' . $friendId); if ($subResult['state'] == 1) { while ($subRows = mysql_fetch_assoc($subResult['msg'])) { $albumId = $subRows['album_id']; //朋友的所有照片 $subSubResult = selectSql('photos', 'photo_id,photo_name,upload_time', "album_id='{$albumId}' ORDER BY upload_time DESC"); if ($subSubResult['state'] == 1) { while ($subSubRows = mysql_fetch_assoc($subSubResult['msg'])) { $srcFile = iconv('utf-8', 'gb2312', $uploadImgPath . $subSubRows['photo_name']); $dstFile = iconv('utf-8', 'gb2312', $thumImgPath . '100_100_' . $subSubRows['photo_name']); thumbnails($srcFile, $dstFile, 100, 100); $friendPhotoInfoArr[] = array('photoId' => $subSubRows['photo_id'], 'photoName' => iconv('gb2312', 'utf-8', $dstFile)); } } } } $friendInfoArr[] = array('friendId' => $friendId, 'friendName' => $friendName, 'friendAvatar' => getAvatar($friendId, $defaultAvatar, $avatarPath), 'friendPhotoInfoArr' => $friendPhotoInfoArr); } } if ($nowUserId == $userId) { $smarty->assign('isAuthor', true); } //读取相册的拥有者 $result = selectSql('users', 'user_name', 'user_id=' . $nowUserId); if ($result['state'] == 1) { $rows = mysql_fetch_assoc($result['msg']);
} } //我上传的图片 //朋友的所有相册 $mePhotoInfoArr = array(); $result = selectSql('albums', 'album_id', 'user_id=' . $nowUserId); if ($result['state'] == 1) { while ($rows = mysql_fetch_assoc($result['msg'])) { $albumId = $rows['album_id']; //朋友的所有照片 $subResult = selectSql('photos', 'photo_id,photo_name,upload_time', "album_id='{$albumId}' ORDER BY upload_time DESC"); if ($subResult['state'] == 1) { while ($subRows = mysql_fetch_assoc($subResult['msg'])) { $srcFile = iconv('utf-8', 'gb2312', $uploadImgPath . $subRows['photo_name']); $dstFile = iconv('utf-8', 'gb2312', $thumImgPath . '75_75_' . $subRows['photo_name']); thumbnails($srcFile, $dstFile, 75, 75); $mePhotoInfoArr[] = array('photoId' => $subRows['photo_id'], 'photoName' => iconv('gb2312', 'utf-8', $dstFile), 'uploadTime' => $subRows['upload_time']); } } } } $smarty->assign('mePhotoInfoArr', $mePhotoInfoArr); $smarty->assign('meAddWho', $meAddWho); $smarty->assign('authorId', $nowUserId); $smarty->assign('friendInfoArr', $friendInfoArr); $smarty->assign('otherUserInfoArr', $otherUserInfoArr); $smarty->assign('photoComments', $photoComments); $smarty->assign('userId', $userId); $smarty->assign('userName', $userName); $smarty->assign('cssFileName', 'personIndex'); $smarty->display('personIndex.tpl');
$con4 = "bbthumb+='{$con4}';"; $con5 = '<a href="' . getlink('show', array($image['id'], '&')) . '"><img src="' . $base['config']['url'] . '/i/' . $image['filename'] . ($image['isthumb'] ? '.th' : '') . $extension . '" alt="Host by ' . $sitename . '" /></a><br />\\r\\n'; $con5 = "htmlthumb+='{$con5}';"; echo $con1 . $con2 . $con3 . $con4 . $con5; exit; } $name = randomstr(1); $targetfile = $targetpath . $name . $extension; while (file_exists($targetfile)) { $name .= randomstr(1); $targetfile = $targetpath . $name . $extension; } move_uploaded_file($tempfile, $targetfile); $thumb = 0; if ($sizew > 180 || $sizeh > 180) { thumbnails($targetfile, $sizew, $sizeh, $targetpath . $name . '.th' . $extension, $filesize, $extension); $thumb = 1; } $now = time(); $db->query("INSERT INTO {$base['config']['db']['pre']}images (ip,time,md5,size,filename,originalname,extension,isthumb) VALUES ('{$_SERVER[REMOTE_ADDR]}','{$now}','{$md5}','{$filesize}','{$name}','{$fullname}','{$extension}','{$thumb}')"); $lastid = $db->last_id(); $img = img($lastid, $base['config']['url'] . '/i/' . $name, $extension, $thumb); $sitename = $_SERVER['HTTP_HOST']; $con1 = "\$('#rezone').before('{$img}');"; $con2 = '[url=' . getlink('show', array($lastid, '&')) . '][img]' . $base['config']['url'] . '/i/' . $name . $extension . '[/img][/url]\\r\\n'; $con2 = "bbfull+='{$con2}';"; $con3 = '<a href="' . getlink('show', array($lastid, '&')) . '"><img src="' . $base['config']['url'] . '/i/' . $name . $extension . '" alt="Host by ' . $sitename . '" /></a><br />\\r\\n'; $con3 = "htmlfull+='{$con3}';"; $con4 = '[url=' . getlink('show', array($lastid, '&')) . '][img]' . $base['config']['url'] . '/i/' . $name . ($thumb ? '.th' : '') . $extension . '[/img][/url]\\r\\n'; $con4 = "bbthumb+='{$con4}';"; $con5 = '<a href="' . getlink('show', array($lastid, '&')) . '"><img src="' . $base['config']['url'] . '/i/' . $name . ($thumb ? '.th' : '') . $extension . '" alt="Host by ' . $sitename . '" /></a><br />\\r\\n';