当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::getPublic方法代码示例

本文整理汇总了PHP中Photo::getPublic方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::getPublic方法的具体用法?PHP Photo::getPublic怎么用?PHP Photo::getPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo::getPublic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGraphHeader

function getGraphHeader($photoID)
{
    if (!isset($photoID)) {
        return false;
    }
    $photo = new Photo(null, null, $photoID);
    if ($photo->getPublic('') === false) {
        return false;
    }
    $sql = "SELECT title, description, url, medium FROM photos WHERE id =" . intval($photoID);
    $res = pg_query($db, $sql);
    $row = pg_fetch_array($res);
    if (!$result || !$row) {
        return false;
    }
    if ($row['medium'] === '1') {
        $dir = 'medium';
    } else {
        $dir = 'big';
    }
    $parseUrl = parse_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    $url = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '?' . $parseUrl['query'];
    $picture = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '/../uploads/' . $dir . '/' . $row['url'];
    $url = htmlentities($url);
    $picture = htmlentities($picture);
    $row['title'] = htmlentities($row['title']);
    $row['description'] = htmlentities($row['description']);
    $return = '<!-- General Meta Data -->';
    $return .= '<meta name="title" content="' . $row['title'] . '">';
    $return .= '<meta name="description" content="' . $row['description'] . '">';
    $return .= '<link rel="image_src" type="image/jpeg" href="' . $picture . '">';
    $return .= '<!-- Twitter Meta Data -->';
    $return .= '<meta name="twitter:card" content="photo">';
    $return .= '<meta name="twitter:title" content="' . $row['title'] . '">';
    $return .= '<meta name="twitter:image:src" content="' . $picture . '">';
    $return .= '<!-- Facebook Meta Data -->';
    $return .= '<meta property="og:title" content="' . $row['title'] . '">';
    $return .= '<meta property="og:description" content="' . $row['description'] . '">';
    $return .= '<meta property="og:image" content="' . $picture . '">';
    $return .= '<meta property="og:url" content="' . $url . '">';
    return $return;
}
开发者ID:waitman,项目名称:Lychee,代码行数:42,代码来源:misc.php

示例2: getGraphHeader

function getGraphHeader($database, $photoID)
{
    if (!isset($database, $photoID)) {
        return false;
    }
    $photo = new Photo($database, null, null, $photoID);
    if ($photo->getPublic('') === false) {
        return false;
    }
    $query = Database::prepare($database, "SELECT title, description, url, medium FROM ? WHERE id = '?'", array(LYCHEE_TABLE_PHOTOS, $photoID));
    $result = $database->query($query);
    $row = $result->fetch_object();
    if (!$result || !$row) {
        return false;
    }
    if ($row->medium === '1') {
        $dir = 'medium';
    } else {
        $dir = 'big';
    }
    $parseUrl = parse_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    $url = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '?' . $parseUrl['query'];
    $picture = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '/../uploads/' . $dir . '/' . $row->url;
    $url = htmlentities($url);
    $picture = htmlentities($picture);
    $row->title = htmlentities($row->title);
    $row->description = htmlentities($row->description);
    $return = '<!-- General Meta Data -->';
    $return .= '<meta name="title" content="' . $row->title . '">';
    $return .= '<meta name="description" content="' . $row->description . ' - via Lychee">';
    $return .= '<link rel="image_src" type="image/jpeg" href="' . $picture . '">';
    $return .= '<!-- Twitter Meta Data -->';
    $return .= '<meta name="twitter:card" content="photo">';
    $return .= '<meta name="twitter:title" content="' . $row->title . '">';
    $return .= '<meta name="twitter:image:src" content="' . $picture . '">';
    $return .= '<!-- Facebook Meta Data -->';
    $return .= '<meta property="og:title" content="' . $row->title . '">';
    $return .= '<meta property="og:description" content="' . $row->description . ' - via Lychee">';
    $return .= '<meta property="og:image" content="' . $picture . '">';
    $return .= '<meta property="og:url" content="' . $url . '">';
    return $return;
}
开发者ID:mattsches,项目名称:Lychee,代码行数:42,代码来源:misc.php

示例3: getPhotoArchive

 private function getPhotoArchive()
 {
     Module::dependencies(isset($_GET['photoID'], $_GET['password']));
     $photo = new Photo($this->database, $this->plugins, null, $_GET['photoID']);
     $pgP = $photo->getPublic($_GET['password']);
     # Photo Download
     if ($pgP === 2) {
         # Photo Public
         $photo->getArchive();
     } else {
         # Photo Private
         exit('Warning: Photo private or password incorrect!');
     }
 }
开发者ID:thejandroman,项目名称:Lychee,代码行数:14,代码来源:Guest.php


注:本文中的Photo::getPublic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。