本文整理汇总了PHP中Photograph类的典型用法代码示例。如果您正苦于以下问题:PHP Photograph类的具体用法?PHP Photograph怎么用?PHP Photograph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Photograph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Keav,项目名称:btbsandbox,代码行数:33,代码来源:comment.php
示例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);
}
开发者ID:dylan18595,项目名称:Picter,代码行数:7,代码来源:getLikes.php
示例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;
?>
开发者ID:afthaj,项目名称:gaman-new,代码行数:31,代码来源:admin-list-admin-users.php
示例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;
开发者ID:AlaminMahamud,项目名称:PHP-Beyond-The-Basics-Essential-Training,代码行数:31,代码来源:photo.php
示例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;
?>
开发者ID:raynaldmo,项目名称:php-education,代码行数:31,代码来源:index.php
示例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>
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:hotel_page.php
示例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>
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:edit_hotel.php
示例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();
?>
开发者ID:saurabh8410,项目名称:Php,代码行数:31,代码来源:images.php
示例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;
?>
开发者ID:RichJones22,项目名称:photo_gallery,代码行数:31,代码来源:index.php
示例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.";
开发者ID:ryanhightower,项目名称:gallery,代码行数:31,代码来源:upload.php
示例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');
}
开发者ID:ciplpj,项目名称:photo_gallery,代码行数:18,代码来源:delete_photo.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">
开发者ID:raph8888,项目名称:raph-web.com,代码行数:31,代码来源:my_photo_album.php
示例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 = "";
//
开发者ID:urg3n,项目名称:gallery_project_php,代码行数:31,代码来源:listitem.php
示例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> -->
开发者ID:raph8888,项目名称:raph-web.com,代码行数:31,代码来源:others.php
示例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>
开发者ID:VeraKH,项目名称:project-php,代码行数:31,代码来源:photo_view.php
示例16: redirect_to
}
if (isset($_POST['update'])) {
if ($_POST['old_password'] == $user->password) {
$user->password = $_POST['new_password'];
if ($admin_user->update()) {
$session->message("Success! The password was updated. ");
redirect_to('public-view-profile.php');
} else {
$session->message("Error! The user details could not be updated. ");
}
} else {
$session->message("Error! The existing password did not match. ");
}
}
if (isset($_POST['upload'])) {
$photo = new Photograph();
$photo->commuter_id = $user->id;
$photo->photo_type = 9;
// photo_type 9 is "User Profile"
$photo->attach_file_commuter($_FILES['file_upload'], $user->id, $user->first_name, $user->last_name);
if ($photo->save()) {
$session->message("Success! The photo was uploaded successfully. ");
redirect_to('public-view-profile.php');
} else {
$message = join("<br />", $photo->errors);
}
}
} else {
//everyone else
$session->message("Error! You do not have sufficient priviledges to view the requested page. ");
redirect_to("index.php");
开发者ID:afthaj,项目名称:gaman-new,代码行数:31,代码来源:public-view-profile.php
示例17: foreach
</div><!-- pets -->
</div><!-- page-right -->
</div><!-- page-wraper -->
<?php
if (isset($five_hotels) && count($five_hotels) === 5) {
?>
<div class="page-wraper">
<div class="recommended clear-fix">
<h1>Hotels Around</h1>
<?php
foreach ($five_hotels as $hotel) {
?>
<?php
$photo = Photograph::first_photo($hotel->id);
?>
<div class="recommended-hotel">
<div class="bg-mask"></div>
<a href="#" class="hover-img"><img src="<?php
echo $photo ? $photo->image_path() : "images/osnovna.jpg";
?>
"></a>
<a href="page.php?id=<?php
echo $hotel->id;
?>
" class="hotel-link"><?php
echo $hotel->hotel_name;
?>
</a>
</div><!-- recommended-hotel -->
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:page.php
示例18: Photograph
<?php
//init code
$photo_object = new Photograph();
$admin_user_object = new AdminUser();
$bus_personnel_object = new BusPersonnel();
$route_object = new BusRoute();
$bus_object = new Bus();
$bus_bus_personnel_object = new BusBusPersonnel();
//check login
if ($session->is_logged_in()) {
if ($session->object_type == 5) {
$session->message("The requested page is for use by Bus Personnel only. ");
redirect_to("index.php");
} else {
if ($session->object_type == 4) {
//bus personnel
$user = $bus_personnel_object->find_by_id($_SESSION['id']);
$profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id);
if ($user->role == 1 || $user->role == 4 || $user->role == 5) {
//bus_personnel that is logged in is an owner (role is 1 (Owner), 4 (Owner + Driver) or 5 (Owner + Conductor))
$buses = $bus_bus_personnel_object->get_buses_for_personnel($user->id);
} else {
if ($user->role == 2 || $user->role == 3) {
//bus_personnel that is logged in is not an owner
$buses = $bus_bus_personnel_object->get_buses_for_personnel($user->id);
}
}
} else {
//everyone else
$session->message("Error! You do not have sufficient priviledges to view the requested page. ");
开发者ID:afthaj,项目名称:gaman-new,代码行数:31,代码来源:admin-list-buses-for-personnel.php
示例19: Photograph
}
$max_file_size = 1048567;
$message1 = "";
$message2 = "";
$message3 = "";
$message4 = "";
if (isset($_POST['submit'])) {
$photo = new Photograph();
$photo->hotel_id = $hotel->id;
$photo->attach_file($_FILES['upload_file']);
if ($photo->save()) {
$message1 = "Photographs was successfully uploaded";
} else {
$message1 = join("<br>", $photo->errors);
}
$photo1 = new Photograph();
$photo1->hotel_id = $hotel->id;
$photo1->attach_file($_FILES['upload_file1']);
if ($photo1->save()) {
$message2 = "Photographs was successfully uploaded";
} else {
$message2 = join("<br>", $photo1->errors);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>
Hotel
</title>
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:upload_photo.php
示例20: Photograph
<?php
require_once '../inc/initialize.php';
$photograph = new Photograph();
$photograph_details = $photograph->find_by_id($session->applicant_id);
if ($_FILES['picture']['error'] == 2) {
sleep(2);
echo '<h4 class="alert alert-error">Error</h4>';
echo '<hr>';
echo "Maximum File size Exceeded(250Kb)";
die;
}
if (!empty($photograph_details) && !empty($_FILES['picture']['name'])) {
$photograph->image_id = $photograph_details->image_id;
unlink(SITE_ROOT . DS . 'passport' . DS . $photograph_details->filename);
}
$arrayfiledetails = explode('.', $_FILES['picture']['name']);
$extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1];
$_FILES['picture']['name'] = $session->applicant_id . '.' . $extension;
if ($photograph->attach_file($_FILES['picture'])) {
$photograph->caption = User::applicant_fullname($session->applicant_id);
$photograph->applicant_id = $session->applicant_id;
//explode filename to get file extension
$photograph->filename = $_FILES['picture']['name'];
if ($photograph->save()) {
$user = new User();
$user->applicant_id = $session->applicant_id;
$user->updateProgress('G');
sleep(2);
echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
echo '<hr>';
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:ajax_passport.php
注:本文中的Photograph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论