Create a Responsive Gallery Using PHP, CSS and JAVASCRIPT

0
81

Good day everyone. Today! another tutorial for some advanced web developers which will developed their own gallery page for their web based projects.

This tutorial is the combination of 3 programming languages. The PHP, CSS, and the JAVASCRIPT. PHP for accessing the database and managing datas through pages, then CSS or cascading stylesheet for the page design, and last is the JAVASCRIPT for an interactive effects beyond the website.

So let’s start our tutorial.

First, create a database. Name it as any name you desire. In my case, i use “itsourcecode” as the name of the database.

Then create a table, name it as  “gallery”. Then put the following attributes.

  1. CREATE TABLE `gallery` ( `pic_id` int(11) NOT NULL, `pic_link` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Now for the connection to the database. Create a “connection.php” file then put the following codes.

  1. <?php
  2. $mysqli = new mysqli('localhost', 'root', '', 'itsourcecode') or die(mysqli_errno($mysqli));
  3. ?>

At the index page. Please put the following codes.

  1. <?php include 'connection.php'; ?>
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Responsive Gallery</title>
  6. <link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css"/>
  7. <a href="http://assets/js/bootstrap.js">http://assets/js/bootstrap.js</a>
  8. &lt;link href="assets/fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css"/&gt;
  9. $("[data-fancybox]").fancybox({ });
  10.  
  11. &lt;/head&gt;
  12. &lt;body&gt;
  13. <div class="container">
  14. <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-upload"></span> Upload Photo</button>
  15. <div class="panel panel-default" style="margin-top: 10px">
  16. <div class="panel-body">
  1. </div>
  2. &lt;/div&gt;
  3. &lt;/div&gt;
  4.  
  5. &lt;!-- Start Upload Photo Modal --&gt;
  6. <div id="uploadPhotoModal" class="modal fade" role="dialog">
  7. <div class="modal-dialog">
  8. <div class="modal-content">
  9. <div class="modal-header">
  10. <button type="button" class="close">x</button>
  11. <h5 class="modal-title"><span class="glyphicon glyphicon-upload"></span> Upload Photo</h5>
  12. </div>
  13. &lt;form method="post" action="upload-action.php" enctype="multipart/form-data" role="form"&gt;
  14. <div class="modal-body">
  15.  
  16. </div>
  17. <div class="modal-footer">
  18. <div class="btn-group">
  19. <button type="button" class="btn btn-danger">Close</button>
  20. <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-upload"></span> Upload</button>
  21. </div>
  22. &lt;/div&gt;
  23. &lt;/form&gt;
  24. &lt;/div&gt;
  25. &lt;/div&gt;
  26. &lt;/div&gt;
  27. &lt;!-- End Upload Photo Modal --&gt;
  28.  
  29. <a href="http://assets/js/jquery.min.js">http://assets/js/jquery.min.js</a>
  30. <a href="http://assets/js/modal.js">http://assets/js/modal.js</a>
  31. <a href="http://assets/fancybox/jquery.fancybox.js">http://assets/fancybox/jquery.fancybox.js</a>
  32. &lt;/body&gt;
  33. &lt;/html&gt;
Facebook Comments
(Visited 83 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here