本文整理汇总了PHP中Photo::getPhotoWithID方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::getPhotoWithID方法的具体用法?PHP Photo::getPhotoWithID怎么用?PHP Photo::getPhotoWithID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::getPhotoWithID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPoster
public function getPoster()
{
if (Photo::photoExists($this->record['poster_id'])) {
return Photo::getPhotoWithID($this->record['poster_id']);
} else {
$photos = $this->getPhotos();
return $photos[0];
}
}
示例2: getPopularPhotos
/**
* Get an array of the popular photos
*
* @access public
* @return array
*/
public function getPopularPhotos()
{
$popularPhotos = array();
$query = Database::select('photos', 'id', null, 'ORDER BY hits DESC limit 5');
while ($photo = $query->fetchAssoc()) {
$popularPhotos[] = Photo::getPhotoWithID($photo['id']);
}
return $popularPhotos;
}
示例3: getPhotos
/**
* Returns photos per QUERY, privacy, and paging restrictions
*
* @access public
* @return Photo[]
*/
public function getPhotos()
{
$sort = $this->photoSortSqlForOption($this->sort);
$condition = $this->whereRestriction;
if (!$this->showPrivatePhotos) {
$condition .= ' AND status = 0';
}
$query = Database::Select('ratings', 'photos.id', $condition, 'ORDER BY ' . $sort . ' ' . 'LIMIT ' . $this->offset . ',' . $this->pageSize, 'LEFT JOIN photos ON ratings.id = photos.id
LEFT JOIN exif ON photos.id=exif.photoid and exif.tag="Date taken"');
$photos = array();
while ($row = $query->fetchAssoc()) {
$photos[] = Photo::getPhotoWithID($row['id']);
}
return $photos;
}
示例4: getPhotos
/**
* Returns photos per QUERY, privacy, and paging restrictions
*
* @access public
* @return Photo[]
*/
public function getPhotos()
{
$sort = $this->photoSortSqlForOption($this->sort);
$conditions = array();
$binds = array();
$conditions[0] = "(path = :1)";
$binds[1] = $this->path;
if (!$this->showPrivatePhotos) {
$conditions[] = 'status = 0';
}
$query = Database::select('photos', 'id', implode(' AND ', $conditions), 'ORDER BY ' . $sort . ' ' . 'LIMIT ' . $this->offset . ',' . $this->pageSize, 'LEFT JOIN exif ON photos.id=exif.photoid and exif.tag="Date taken"', $binds);
$photos = array();
while ($row = $query->fetchAssoc()) {
$photos[] = Photo::getPhotoWithID($row['id']);
}
return $photos;
}
示例5: getPhotos
/**
* Returns photos per QUERY, privacy, and paging restrictions
*
* @access public
* @return Photo[]
*/
public function getPhotos()
{
$sort = $this->photoSortSqlForOption($this->sort);
$conditions = array();
$binds = array();
foreach (preg_split('/\\s+/', $this->query) as $i => $queryPart) {
$conditions[$i] = "(description LIKE :{$i} OR keywords LIKE :{$i})";
$binds[$i] = '%' . $queryPart . '%';
}
if (!$this->showPrivatePhotos) {
$conditions[] = 'status = 0';
}
$query = Database::Select('photos', 'id', implode(' AND ', $conditions), 'ORDER BY ' . $sort . ' ' . 'LIMIT ' . $this->offset . ',' . $this->pageSize, 'LEFT JOIN exif ON photos.id=exif.photoid and exif.tag="Date taken"', $binds);
$photos = array();
while ($row = $query->fetchAssoc()) {
$photos[] = Photo::getPhotoWithID($row['id']);
}
return $photos;
}
示例6: getObject
/**
* Factory for the associated object
*
* @access public
* @return mixed
*/
public function getObject()
{
if ($this->record['record_type'] == 'photo') {
return Photo::getPhotoWithID($this->record['record_id']);
}
if ($this->record['record_type'] == 'album') {
return new Album($this->record['record_id']);
}
if ($this->record['record_type'] == 'preference') {
return $cameralife;
}
$cameralife->Error("Unknown receipt type: " . $this->record['record_type']);
return false;
}