Skip to content

Commit

Permalink
displaying photographer's photos in gallery on portfolio and added ca…
Browse files Browse the repository at this point in the history
…tegory and tags to image upload
  • Loading branch information
Vanessa Pinto authored and Vanessa Pinto committed Apr 22, 2019
1 parent 7eecdec commit ae11e7d
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 29 deletions.
7 changes: 4 additions & 3 deletions backend/profile-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
session_start();
require('connect.php');

if (isset($_GET['username']) and isset($_GET['name']) and isset($_GET['email'])){
if (isset($_GET['username']) and isset($_GET['fname']) and isset($_GET['lname']) and isset($_GET['email'])){
$photographer = $_GET['username'];
$name = $_GET['name'];
$fname = $_GET['fname'];
$lname = $_GET['lname'];
$email = $_GET['email'];
// $msg_subject = $_GET['Subject'];

Expand Down Expand Up @@ -59,7 +60,7 @@

// echo $username;

$query = "UPDATE public.users_info SET profile_email='$email',lname = '$name',facebook_url = '$facebook',twitter_url = '$twitter',pinterest_url = '$pinterest',instagram_url = '$instagram',pnum = '$phone',designation = '$title',about = '$about',address = '$address',projects = '$projects',clients = '$clients' WHERE email = '$photographer'";
$query = "UPDATE public.users_info SET profile_email='$email',fname = '$fname',lname = '$lname',facebook_url = '$facebook',twitter_url = '$twitter',pinterest_url = '$pinterest',instagram_url = '$instagram',pnum = '$phone',designation = '$title',about = '$about',address = '$address',projects = '$projects',clients = '$clients' WHERE email = '$photographer'";
$result = pg_query($connection, $query) or die('Query failed: ' . pg_last_error());
if($result){
echo 'success';
Expand Down
2 changes: 1 addition & 1 deletion dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="main-menu h-100">
<nav class="navbar h-100 navbar-expand-lg">
<!-- Logo Area -->
<a class="navbar-brand" href="index.html"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>
<a class="navbar-brand" href="#"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#studioMenu" aria-controls="studioMenu" aria-expanded="false" aria-label="Toggle navigation"><i class="fa fa-bars"></i> Menu</button>

Expand Down
58 changes: 45 additions & 13 deletions gallery.html → gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<link href="css/responsive.css" rel="stylesheet">
<style>
body, h1,h2,h3,h4,h5,h6 {font-family: "Montserrat", sans-serif}
.w3-row-padding img {margin-bottom: 12px}
.w3-row-padding img {margin-bottom: 12px; float:left;}
.bgimg {
background-position: center;
background-repeat: no-repeat;
Expand All @@ -38,18 +38,49 @@

<!-- Sidebar with image -->
<div class="imgnav" >
<img src="./img/core-img/side.jpg" class="portfolioimg" height="-webkit-fill-available" />
</div>
<div class="sidenav" >
<a id="side" href="portfolio.html">About</a>
<a id="active" href="#">Gallery</a>
<a id="side" href="skills.html">Skills</a>
<a id="side" href="portfoliocontact.html">Contact Me</a>
</div>
<div class="main" style="margin-left:270px; ">
<img src="./img/core-img/side.jpg" class="portfolioimg" height="-webkit-fill-available" />
</div>
<div class="sidenav" >
<a id="side" href="portfolio.php">About</a>
<a id="active" href="#">Gallery</a>
<a id="side" href="skills.html">Skills</a>
<a id="side" href="portfoliocontact.php">Contact Me</a>
</div>
<div class="main" style="margin-left:270px; ">
<div class="w3-row-padding" >
<div class="w3-half " style="">
<img src="./W3.CSS Template_files/wedding.jpg" style="width:100%">
<div class="w3-half container-fluid">
<?php
session_start();
if(isset($_SESSION['username'])){

$username = $_SESSION['username'];
require('backend/connect.php');

$query="SELECT name FROM public.imagestore WHERE photographer_id='$username'";
$result = pg_query($connection, $query) or die('Query failed: ' . pg_last_error());
if(pg_num_rows($result) > 0){
$i=0;
$arr=pg_fetch_all($result);
while($i < pg_num_rows($result))
{
$img_file="upload/".$arr[$i]['name'];
echo '<img src="'.$img_file.'">';
// if($i == (pg_num_rows($result)/2) ){
// echo '</div';
// echo '<div class="w3-half">';
// }
$i=$i+1;
}
}
else {
echo '<script language="javascript">';
echo "alert('No images!')";
echo '</script>';
}
}
pg_close($connection);
?>
<!-- <img src="./W3.CSS Template_files/wedding.jpg" style="width:100%">
<img src="./W3.CSS Template_files/rocks.jpg" style="width:100%">
<img src="./W3.CSS Template_files/sailboat.jpg" style="width:100%">
</div>
Expand All @@ -59,8 +90,9 @@
<img src="./W3.CSS Template_files/chef.jpg" style="width:100%">
<img src="./W3.CSS Template_files/wedding.jpg" style="width:100%">
<img src="./W3.CSS Template_files/p6.jpg" style="width:100%">
</div>
</div> -->
<!-- End photo grid -->
</div>
</div>
<!-- Hidden Sidebar (reveals when clicked on menu icon)-->
<nav class="w3-sidebar w3-black w3-animate-right w3-xxlarge" style="display:none;padding-top:150px;right:0;z-index:2" id="mySidebar">
Expand Down
18 changes: 13 additions & 5 deletions pages-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<div class="main-menu h-100">
<nav class="navbar h-100 navbar-expand-lg">
<!-- Logo Area -->
<a class="navbar-brand" href="index.html"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>
<a class="navbar-brand" href="#"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#studioMenu" aria-controls="studioMenu" aria-expanded="false" aria-label="Toggle navigation"><i class="fa fa-bars"></i> Menu</button>

Expand Down Expand Up @@ -143,9 +143,15 @@
<form class="form-horizontal form-material" id="updateForm">
<input type="hidden" name="username" id="username" value="<?php echo htmlspecialchars($username);?>" >
<div class="form-group">
<label class="col-md-12">Full Name</label>
<label class="col-md-12">First Name</label>
<div class="col-md-12">
<input type="text" placeholder="Johnathan Doe" class="form-control form-control-line" id="name">
<input type="text" placeholder="Johnathan" class="form-control form-control-line" id="fname">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Last Name</label>
<div class="col-md-12">
<input type="text" placeholder="Doe" class="form-control form-control-line" id="lname">
</div>
</div>
<div class="form-group">
Expand Down Expand Up @@ -292,7 +298,8 @@
// console.log("Hello");
event.preventDefault();
var username = document.getElementById("username").value;
var name = document.getElementById("name").value;
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var facebook = document.getElementById("facebook").value;
var twitter = document.getElementById("twitter").value;
Expand Down Expand Up @@ -327,7 +334,8 @@
type: 'GET',
data: {
username: username,
name: name,
fname: fname,
lname: lname,
email: email,
facebook: facebook,
twitter: twitter,
Expand Down
15 changes: 13 additions & 2 deletions photos.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="main-menu h-100">
<nav class="navbar h-100 navbar-expand-lg">
<!-- Logo Area -->
<a class="navbar-brand" href="index.html"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>
<a class="navbar-brand" href="#"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#studioMenu" aria-controls="studioMenu" aria-expanded="false" aria-label="Toggle navigation"><i class="fa fa-bars"></i> Menu</button>

Expand Down Expand Up @@ -128,9 +128,20 @@
</form>
</div> -->
</div>
<form method="post" action="save_path.php" enctype='multipart/form-data' style="margin-bottom:3%;">
<form class="form-inline" method="post" action="save_path.php" enctype='multipart/form-data' style="margin-bottom:3%;">
<input type="hidden" name="username" value="<?php echo htmlspecialchars($username);?>">
<input type='file' name='file' />
<select class="form-control" name="category" style="margin-right:0.5%">
<option value="" selected disabled>Category</option>
<option>Portraits</option>
<option>Weddings</option>
<option>Studio</option>
<option>Fashion</option>
<option>Lifestyle</option>
<option>Nature</option>
<option>Other</option>
</select>
<input type="text" placeholder="tags" class="form-control form-control-line" name="tags" style="margin-right:0.5%">
<input class="btn btn-success" type='submit' value='Upload Photos' name='but_upload'>
<!-- <button class="btn btn-success" type='submit'name='but_upload'>Upload Photos</button> -->
</form>
Expand Down
2 changes: 1 addition & 1 deletion portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</div>
<div class="sidenav" >
<a id="active" href="#">About</a>
<a id="side" href="gallery.html">Gallery</a>
<a id="side" href="gallery.php">Gallery</a>
<a id="side" href="skills.html">Skills</a>
<a id="side" href="portfoliocontact.php">Contact Me</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions portfoliocontact.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<img src="./img/core-img/side.jpg" class="portfolioimg" height="-webkit-fill-available" />
</div>
<div class="sidenav" >
<a id="side" href="portfolio.html">About</a>
<a id="side" href="gallery.html">Gallery</a>
<a id="side" href="portfolio.php">About</a>
<a id="side" href="gallery.php">Gallery</a>
<a id="side" href="skills.html">Skills</a>
<a id="active" href="#">Contact Me</a>
</div>
Expand Down
6 changes: 4 additions & 2 deletions save_path.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php
require("backend/connect.php");

if(isset($_POST['but_upload']) and isset($_POST['username'])){
if(isset($_POST['but_upload']) and isset($_POST['username']) and isset($_POST['category']) and isset($_POST['tags'])){

$photographer = $_POST['username'];
$category = $_POST['category'];
$tags = $_POST['tags'];
$name = $_FILES['file']['name'];
$target_dir = "upload/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
Expand All @@ -21,7 +23,7 @@
move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);
chmod($target_dir.$name, 0755);
// Insert record
$query = "INSERT INTO public.imagestore(name,photographer_id) values('".$name."','".$photographer."')";
$query = "INSERT INTO public.imagestore(name,photographer_id,category,tags) values('".$name."','".$photographer."','".$category."','".$tags."')";
$result = pg_query($connection, $query) or die('Query failed: ' . pg_last_error());
// if($result){
// echo 'success';
Expand Down

0 comments on commit ae11e7d

Please sign in to comment.