コード例 #1
0
ファイル: show.php プロジェクト: lz1988/stourwebcms
$pv = new View($typeid);
Helper_Archive::loadModule('common');
if (!isset($id)) {
    exit('Wrong Id');
}
$aid = RemoveXSS($id);
//防止跨站攻击
updateVisit($aid, $typeid);
$row = getPhotoInfo($aid);
if (empty($row['id'])) {
    head404();
}
$photoid = $row['id'];
$destlist = getPhotoChildDest($dest_id);
if (is_array($row)) {
    $row['num'] = getPhotoNum($aid);
    $row['subname'] = $row['title'];
    $row['litpic'] = !empty($row['litpic']) ? $row['litpic'] : getDefaultImage();
    //获取目的地
    $destlist = $destlist = getPhotoChildDest($row['kindlist'], true);
    //SEO优化信息
    $row['seodescription'] = !empty($row['description']) ? "<meta name=\"description\" content=\"" . $row['description'] . "\"/>" : "";
    $row['seokeyword'] = !empty($row['keyword']) ? "<meta name=\"keywords\" content=\"" . $row['keyword'] . "\"/>" : "";
    $row['seotitle'] = !empty($row['seotitle']) ? $row['seotitle'] : $row['title'];
    $row['commenthomeid'] = $row['id'];
    //图片
    $picturelist = getPhotoPictures($row['id'], 'lit240');
    //列表
    if (empty($imgid)) {
        $firstpic = $picturelist[0];
    } else {
コード例 #2
0
ファイル: albumList.php プロジェクト: hnliji1107/photo-blog
<?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');
コード例 #3
0
ファイル: myPhotos.php プロジェクト: hnliji1107/photo-blog
<?php

require 'public.php';
$nowUserId = $_GET['userId'] == '' ? $userId : $_GET['userId'];
if (!empty($nowUserId)) {
    $photoInfoArr = array();
    $albumInfoArr = array();
    $result = selectSql('albums', 'album_id,album_name,album_cover', 'user_id=' . $nowUserId);
    if ($result['state'] == 1) {
        while ($rows = mysql_fetch_assoc($result['msg'])) {
            $albumId = $rows['album_id'];
            //读取所有相册信息
            $albumInfoArr[] = array('id' => $albumId, 'name' => $rows['album_name'], 'photoNum' => getPhotoNum($albumId), 'cover' => $rows['album_cover'] == '' ? getAlbumCover($albumId, $defaultAlbumCover, $uploadImgPath) : $uploadImgPath . $rows['album_cover']);
            $subResult = selectSql('photos', 'photo_id,photo_name,edit_name,photo_desc,upload_time', 'album_id=' . $albumId);
            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 . '240_' . $subRows['photo_name']);
                    //生成缩略图
                    thumbnails($srcFile, $dstFile, 240, '');
                    //读取所有照片信息
                    $photoInfoArr[] = array('id' => $subRows['photo_id'], 'path' => iconv('gb2312', 'utf-8', $dstFile), 'name' => $subRows['edit_name'] == '' ? $subRows['photo_name'] : $subRows['edit_name'], 'description' => $subRows['photo_desc'], 'uploadTime' => $subRows['upload_time']);
                }
            }
        }
    }
    if ($nowUserId == $userId) {
        $smarty->assign('isAuthor', true);
    }
    //读取相册的拥有者
    $result = selectSql('users', 'user_name,user_avatar', 'user_id=' . $nowUserId);