本文整理汇总了PHP中Photo::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::get方法的具体用法?PHP Photo::get怎么用?PHP Photo::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileUsage
/**
* Get the total file usage
* @param bool $user
* @return int
*/
function getFileUsage($user = false)
{
$total = 0;
if (!empty($user)) {
$search = ['user' => $user];
} else {
$search = [];
}
if ($photos = Photo::get($search, [], 9999, 0)) {
foreach ($photos as $photo) {
/* @var Photo $photo */
if ($attachments = $photo->getAttachments()) {
foreach ($attachments as $attachment) {
$total += $attachment['length'];
}
}
}
}
return $total;
}
示例2: getPhoto
private function getPhoto()
{
Module::dependencies(isset($_POST['photoID'], $_POST['albumID']));
$photo = new Photo($this->database, $this->plugins, null, $_POST['photoID']);
echo json_encode($photo->get($_POST['albumID']));
}
示例3: getPhoto
function getPhoto()
{
$session = Session::singletone();
$db = Database::singletone()->db();
$pid = Utils::pg("pid", 0);
$w = Utils::pg('w', -1);
$h = Utils::pg('h', -1);
$this->_query->appendChild($this->_dom->createElement("photo-id", $pid));
$this->_query->appendChild($this->_dom->createElement("width", $w));
$this->_query->appendChild($this->_dom->createElement("height", $h));
if ($pid <= 0) {
$this->error("bad-arguments");
return;
}
$photo = new Photo($pid);
$this->_response->appendChild($this->_dom->createElement('photo-id', $photo->dbdata('photo_id')));
$this->_response->appendChild($this->_dom->createElement('photo-title', $photo->dbdata('photo_title')));
$this->_response->appendChild($this->_dom->createElement('photo-description', $photo->dbdata('photo_description')));
$this->_response->appendChild($this->_dom->createElement('photo-added', Utils::formatTime($photo->dbdata('photo_added'), Config::getUser($session->uid(), 'datetime-format'))));
if ($photo->dbdata('photo_approved', 0)) {
$this->_response->appendChild($this->_dom->createElement('photo-approved', 1));
}
$img = $photo->get($w, $h);
$file = $this->_dom->createElement('file', $img[0]);
$file->setAttribute('width', $img[1]);
$file->setAttribute('height', $img[2]);
$this->_response->appendChild($file);
$this->_response->appendChild($photo->author()->xml($this->_dom, 'author'));
//if ($photo->dbdata('photo_approved', 0) > 0)
// $this->_response->appendChild($photo->moderator()->xml($this->_dom, 'moderator'));
$this->_response->appendChild($photo->moderationXML($this->_dom));
$this->_response->appendChild($photo->metaXML($this->_dom));
$this->success();
}
示例4: _photos
protected function _photos()
{
if (!$this->session()->checkPerm("photos-list")) {
$this->denyAccess();
}
$this->addScript("js/functions.js");
$this->addScript("js/behaviour.js");
$this->addScript("js/advajax.js");
$this->addScript("js/ajax.js");
$this->addScript("js/tabs.js");
$this->addScript("js/ac.js");
$this->addScript("js/admin/ctree.js");
$this->addScript("js/admin/photos.js");
$this->addCSS('css/admin/ctree.css');
$this->addCSS('css/admin/tabs.css');
$this->addCSS('css/admin/ac.css');
$this->addCSS('css/admin/preview.css');
$this->addCSS('css/admin/photos.css');
$db = Database::singletone()->db();
$this->setDefaultCount(16);
$wq = $this->getPhotosWhereSql();
$sth = $db->query("SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id " . $wq);
$photos = $sth->fetchColumn(0);
$sth = null;
$sth = $db->prepare('SELECT p.photo_id FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . $wq . ' ORDER BY photo_added DESC LIMIT :p, :c');
$sth->bindValue(":p", $this->startItem());
$sth->bindValue(":c", $this->count());
$sth->execute();
$rows = $sth->fetchAll();
$sth = null;
$aphotos = array();
foreach ($rows as &$row) {
$photo = new Photo($row['photo_id']);
$ph = $photo->fullData();
$ph['file'] = $photo->get(100, 100);
$aphotos[] = $ph;
}
$this->setTemplateVar('photos', $aphotos);
$pages = $this->pager($photos);
$this->setTemplateVar('pager', $pages);
$stats = array();
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p');
$stats['total']['total'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . $wq);
$stats['selected']['total'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . "WHERE pm.moderation_mode = 'approve'");
$stats['total']['approved'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . $wq . " AND pm.moderation_mode = 'approve'");
$stats['selected']['approved'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . "WHERE pm.moderation_mode = 'reject'");
$stats['total']['rejected'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . $wq . " AND pm.moderation_mode = 'reject'");
$stats['selected']['rejected'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p WHERE p.moderation_id IS NULL');
$stats['total']['waiting'] = $sth->fetchColumn(0);
$sth = null;
$sth = $db->query('SELECT COUNT(*) FROM phph_photos p LEFT OUTER JOIN phph_photos_moderation pm ON p.moderation_id = pm.moderation_id ' . $wq . ' AND p.moderation_id IS NULL');
$stats['selected']['waiting'] = $sth->fetchColumn(0);
$sth = null;
//$sth = $db
$this->setTemplateVar('stats', $stats);
//$this->setTemplateVar("users", $rows);
}
示例5: index
/**
* Display a listing of the resource.
* GET /photos
*
* @return Response
*/
public function index()
{
return Response::json(Photo::get());
}
示例6: getPhoto
private function getPhoto()
{
Module::dependencies(isset($_POST['photoID'], $_POST['albumID'], $_POST['password']));
$photo = new Photo($this->database, $this->plugins, null, $_POST['photoID']);
$pgP = $photo->getPublic($_POST['password']);
if ($pgP === 2) {
echo json_encode($photo->get($_POST['albumID']));
} else {
if ($pgP === 1) {
echo 'Warning: Wrong password!';
} else {
if ($pgP === 0) {
echo 'Warning: Photo private!';
}
}
}
}
示例7: _view
protected function _view()
{
$pid = Utils::pg("pid");
$cid = Utils::pg("cid", 0);
$w = Utils::pg("w", 640);
$h = Utils::pg("h", 600);
$ok = true;
if (empty($pid)) {
$ok = false;
}
if ($ok) {
try {
$photo = new Photo($pid);
} catch (Exception2 $e) {
$ok = false;
$this->_smarty->assign("error", 1);
$this->_smarty->assign("error_title", $e->getMessage());
$this->_smarty->assign("error_description", $e->getDescription());
$this->_smarty->assign("error_code", $e->getCode());
}
}
$this->_smarty->assign('pid', $pid);
$this->_smarty->assign('w', $w);
$this->_smarty->assign('h', $h);
if ($ok) {
$data = $photo->get($w, $h);
$this->_smarty->assign('photo_categories', $photo->_categories);
foreach ($photo->_category_objs as $cat) {
$trees[] = $cat->getParentTree(true);
$subtrees[] = $cat->getSubTree(true);
}
$this->_smarty->assign('categories_full', $trees);
$this->_smarty->assign('categories_tree', $subtrees);
$main_c = new Category();
$this->_smarty->assign('full_category_tree', $main_c->getSubTree());
$this->_smarty->assign('photo_id', $photo->_pid);
$this->_smarty->assign('photo_cids', $photo->_cids);
$this->_smarty->assign('photo_cid_map', $photo->_cid_map);
$this->_smarty->assign('photo_url', $data[0]);
$this->_smarty->assign('photo_w', $data[1]);
$this->_smarty->assign('photo_h', $data[2]);
$this->_smarty->assign('photo_imgw', $data[3]);
$this->_smarty->assign('photo_imgh', $data[4]);
$this->_smarty->assign('photo_imgwh', $data[5]);
$this->_smarty->assign('photo_title', $photo->_dbo->photo_title);
$this->_smarty->assign('page_title', $photo->_dbo->photo_title);
$this->_smarty->assign('photo_description', $photo->_dbo->photo_description);
$this->_smarty->assign('post_comment_action', url('postcomment'));
$comments_o = $photo->getComments();
$comments = array();
foreach ($comments_o as $cmnt) {
$comments[] = array('id' => $cmnt->_cmid, 'title' => $cmnt->_dbo->comment_title, 'text' => $cmnt->_dbo->comment_text, 'date' => Utils::formatTime($cmnt->_dbo->comment_date), 'user_id' => $cmnt->_dbo->user_id, 'user_url' => url('user', array('uid' => $cmnt->_dbo->user_id)), 'user_login' => $cmnt->_user->user_login);
}
$this->_smarty->assign('photo_comments', $comments);
if (!$this->_session->requireLogin(false)) {
$this->_smarty->assign('allow_comments', 1);
}
$next_pid = 0;
$prev_pid = 0;
$cat = new Category($cid);
$pids = $cat->getPhotos();
$cid_s = "";
if (!empty($pids)) {
$cid_s = " AND photo_id IN (" . implode(", ", $pids) . ") ";
}
$q = $this->_db->prepare("SELECT photo_id FROM phph_photos WHERE photo_id > ? {$cid_s} ORDER BY photo_id ASC LIMIT 0, 1");
$res = $this->_db->execute($q, array($pid));
if ($row = $res->fetchRow()) {
$prev_pid = $row['photo_id'];
}
$q = $this->_db->prepare("SELECT photo_id FROM phph_photos WHERE photo_id < ? {$cid_s} ORDER BY photo_id DESC LIMIT 0, 1");
$res = $this->_db->execute($q, array($pid));
if ($row = $res->fetchRow()) {
$next_pid = $row['photo_id'];
}
if (!empty($next_pid)) {
$this->_smarty->assign('next_photo', get_photo($next_pid, $cid));
}
if (!empty($prev_pid)) {
$this->_smarty->assign('prev_photo', get_photo($prev_pid, $cid));
}
}
}
示例8: getPhoto
private function getPhoto()
{
Module::dependencies(isset($_POST['photoID'], $_POST['albumID']));
$photo = new Photo(null, $_POST['photoID']);
echo json_encode($photo->get($_POST['albumID']));
}