本文整理汇总了PHP中Photograph类的典型用法代码示例。如果您正苦于以下问题:PHP Photograph类的具体用法?PHP Photograph怎么用?PHP Photograph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Photograph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comment_mail_notification
public function comment_mail_notification()
{
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = SMTP_HOST;
$mail->SMTPAuth = SMTP_AUTH;
$mail->Username = SMTP_USER;
$mail->Password = SMTP_PASS;
$mail->SMTPSecure = SMTP_SECURE;
$mail->Port = SMTP_PORT;
$mail->From = SMTP_FROM;
$mail->FromName = SMTP_FROM_NAME;
$mail->addReplyTo(SMTP_REPLY_TO, SMTP_REPLY_TO_NAME);
$mail->addAddress(SMTP_TO, SMTP_TO_NAME);
$mail->isHTML(SMTP_ISHTML);
$mail->Subject = SMTP_SUBJECT . strftime("%T", time());
$created = datetime_to_text($this->created);
$mail_body = nl2br($this->body);
$photo = Photograph::find_by_id($_GET['id']);
$mail->Body = <<<EMAILBODY
A new comment has been received in the Photo Gallery.<br>
<br>
Photograph: {$photo->filename}<br>
<br>
On {$created}, {$this->author} wrote:<br>
<br>
{$mail_body}<br>
EMAILBODY;
$result = $mail->send();
return $result;
}
示例2: getLikes
function getLikes($picID)
{
$sqlQuery = "SELECT photograph_id FROM votes ";
$sqlQuery .= "WHERE photograph_id ={$picID}";
$photographsQuery = Photograph::find_by_sql($sqlQuery);
echo sizeof($photographsQuery);
}
示例3: AdminLevel
<td>Email Address</td>
<td>Admin Level</td>
<td> </td>
<td> </td>
</tr>
<?php
for ($i = 0; $i < count($users); $i++) {
if ($users[$i]->id != $user->id) {
?>
<tr align="center">
<td>
<?php
$admin_level = new AdminLevel();
$pic = new Photograph();
$user_profile_picture = $pic->get_profile_picture('5', $users[$i]->id);
if (!empty($user_profile_picture->filename)) {
echo '<img src="../../' . $user_profile_picture->image_path() . '" width="100" class="img-rounded" />';
} else {
echo '<img src="../img/default-prof-pic.jpg" width="100" class="img-rounded" alt="Please upload a profile picture" />';
}
?>
</td>
<td><?php
echo $users[$i]->full_name();
?>
</td>
<td><?php
echo $users[$i]->username;
?>
示例4: redirect_to
<?php
require_once "../includes/initialize.php";
if (empty($_GET['id'])) {
$session->message("No photograph id was provided");
redirect_to(index . php);
}
$photo = Photograph::find_by_id($_GET['id']);
if (!$photo) {
$session->message("The photo could not be located");
redirect_to("index.php");
}
?>
<?php
include_layout_template('header.php');
?>
<a href = "index.php">
« Back
</a>
<br/>
<div style="margin-left:20px;">
<img src = "<?php
echo $photo->image_path();
?>
" />
<p>
<?php
echo $photo->caption;
示例5: Pagination
// 1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
// 2. records per page ($per_page)
$per_page = 3;
// 3. total record count ($total_count)
$total_count = Photograph::count_all();
// Find all photos
// use pagination instead
//$photos = Photograph::find_all();
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
$sql = "SELECT * FROM photographs ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$photos = Photograph::find_by_sql($sql);
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
?>
<?php
include_layout_template('header.php');
?>
<?php
foreach ($photos as $photo) {
?>
<div style="float: left; margin-left: 20px;">
<a href="photo.php?id=<?php
echo $photo->id;
?>
示例6: redirect_to
if (!isset($_GET['id'])) {
redirect_to("login.php");
}
$hotel = Hotel::find_by_id($_GET['id']);
if (!$hotel) {
redirect_to("login.php");
}
if ($session->user_id != $hotel->id) {
redirect_to("login.php");
}
$rule = rules::find_hotel_rules($hotel->id);
if (!$rule) {
redirect_to("login.php");
}
$rooms = $hotel->rooms();
$photos = Photograph::find_by_hotel_id($hotel->id);
?>
<!DOCTYPE html>
<html>
<head>
<title>
Hotel
</title>
<link rel="stylesheet" type="text/css" href="../css/reset.css">
<link rel="stylesheet" type="text/css" href="../css/hotel.css">
<link rel="stylesheet" type="text/css" href="../css/demo.css">
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:700,400' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600italic,700' rel='stylesheet' type='text/css'>
<script src="../js/modernizr.js"></script>
示例7: redirect_to
$hotel->hotel_name = $_POST['hotel_name'];
$hotel->address = $_POST['address'];
$hotel->stars = $_POST['stars'];
$hotel->info = $_POST['info'];
if ($hotel->update()) {
redirect_to("page.php?id={$hotel->id}");
}
} else {
$message = "You have to fill all the fields";
}
}
if (isset($_POST['submit'])) {
if (isset($_FILES['slika'])) {
$num = count($_FILES['slika']['name']);
for ($i = 0; $i < $num; $i++) {
$photo = new Photograph();
$photo->hotel_id = $hotel->id;
if ($_FILES['slika']['error'][$i] == 0) {
if ($photo->upload_images($_FILES['slika']['name'][$i], $_FILES['slika']['tmp_name'][$i], $_FILES['slika']['type'][$i], $_FILES['slika']['size'][$i])) {
$message = "Photographs successfully uploaded";
} else {
$message = join('<br>', $photo->errors);
}
} else {
$message = "Can't upload <b>" . $_FILES['slika']['name'][$i] . "</b><br/>";
}
}
}
}
?>
<!DOCTYPE html>
示例8: foreach
<?php
require_once '../includes/includes_all.php';
$cat = !empty($_GET['cat']) ? (int) $_GET['cat'] : 1;
$qry = "select * from tblimages where cat_id={$cat}";
$photos = Photograph::find_by_sql($qry);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheets/style.css"/>
<title>Wallpaper Hub</title>
</head>
<body>
<div id="main">
<?php
include_layout_template('header.php');
?>
<?php
include_layout_template('menu.php');
?>
<div id="contents" >
<div style="width:99%; padding:5px;" >
<?php
if ($session->is_logged_in()) {
?>
<?php
foreach ($photos as $photo) {
?>
<a href="<?php
echo $photo->image_path();
?>
示例9: Pagination
<?php
require_once "../includes/initialize.php";
// pagination
// 1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
// 2. records per page ($per_page)
$per_page = 1;
// 3. total record count ($total_count)
$total_count = Photograph::count_all();
//$photos = Photograph::find_all();
$pagination = new Pagination($page, $per_page, $total_count);
$photos = Photograph::get_current_page($pagination);
?>
<?php
include_layout_template('header.php');
?>
<?php
echo output_message($message);
?>
<?php
foreach ($photos as $photo) {
?>
<div style="float: left; margin-left: 20px;">
<a href="photo.php?id=<?php
echo $photo->id;
?>
示例10: array
<?php
require_once "../includes/initialize.php";
// In an application, this could be moved to a config file
$upload_errors = array(UPLOAD_ERR_OK => "No errors.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file.", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Can't write to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension.");
if (isset($_POST['submit'])) {
// process form data
/*
$tmp_file = $_FILES['file_upload']['tmp_name'];
$target_file = basename($_FILES['file_upload']['name']);
$upload_dir = dirname(__FILE__)."/uploads";
*/
$photo = new Photograph();
if ($photo->attach_file($_FILES['file_upload'])) {
echo "success.<br />";
echo "<pre>";
print_r($photo);
echo "</pre>";
} else {
echo "error.<br />";
echo "<pre>";
print_r($photo->errors);
echo "</pre>";
}
/* You will probably want to first use file_exists() to make sure
there isn't already a file by the same name. */
/* move_uploaded_file will return false if $tmp_file is not a valid file
or if it cannot be moved for any other reason. */
/*
if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)){
$message = "File uploaded successfully.";
示例11: redirect
<?php
require_once '../../includes/initialize.php';
if (!$session->is_logged_in()) {
redirect("login.php");
}
if (empty($_GET['id'])) {
$session->set_get_message("Photo's Id Not Selected");
redirect('index.php');
}
$photo = Photograph::find_by_id($database->escape_value($_GET['id']));
if ($photo && $photo->destroy()) {
$session->set_get_message("Photograph {$photo->filename} Deleted Successfully");
redirect('view_photograph.php');
} else {
$session->set_get_message("Photograph Couldn't Be Deleted");
redirect('view_photograph.php');
}
示例12: Header
<?php
include 'header.php';
?>
<?php
if (!isset($_SESSION['myid'])) {
Header("Location: index.php");
}
?>
<?php
$getphotos = $_SESSION['myid'];
$photos = Photograph::find_by_id_many($id = $getphotos);
?>
<div class="main-content-wrapper clearfix">
<div class="login_main">
<div class= "login_main_inner">
<h2>My Photo Album</h2>
<?php
echo output_message($message);
?>
<table class="bordered">
示例13: redirect_to
<?php
$message = "TESTSET";
require_once '../../includes/photograph.php';
require_once '../../includes/functions.php';
require_once '../../includes/session.php';
if (!$session->is_logged_in()) {
redirect_to("login.php");
}
$max_file_size = 1048576;
if (isset($_POST['submit'])) {
$photo = new Photograph();
$photo->caption = $_POST['caption'];
$photo->attach_file($_FILES['file_upload']);
if ($photo->save()) {
$message = "Photograph uploaded";
} else {
$message = join("<br>", $photo->errors);
}
}
//print_r($_FILES['file_upload']);
$upload_errors = array(UPLOAD_ERR_OK => "File Uploaded.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file. Please select at least one file", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Can't write to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension.");
//if(isset($_POST['submit'])) {
// //process the form data
// $tmp_file = $_FILES['file_upload']['tmp_name'];
// $target_file = basename($_FILES['file_upload']['name']);
// $upload_dir = "uploads";
// if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file))
// {
// $message = "";
//
示例14: while
$result = $database->query($sql);
while ($row = $result->fetch_assoc()) {
?>
<h2><?php
echo $row['username'];
?>
</h2>
<img width="200px" length="200px" src="<?php
echo $row['image1'];
?>
">
<?php
$photos = Photograph::find_by_id_many($id = $others);
$numberphotos = count($photos);
?>
<a href="others_photo_album.php?set=<?php
echo $others;
?>
"><p>Photo Album (<?php
echo $numberphotos;
?>
)</p></a>
<!-- <h3><?php
echo $row['location'];
?>
</h3> -->
示例15: Messages
<div>
<h2>Photo view</h2>
<?php
echo Messages($message);
?>
<table>
<tr>
<th>Photo</th>
<th>Filename</th>
<th>Caption</th>
<th>Size</th>
<th>Type</th>
</tr>
<?php
$photos = Photograph::FindAll();
foreach ($photos as $photo) {
?>
<tr>
<td><img src="../<?php
echo $photo->ImagePath();
?>
" width="200px;"</td>
<td><?php
echo $photo->filename;
?>
</td>
<td><?php
echo $photo->caption;
?>
</td>