本文整理匯總了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;
}