Home  • Programming • PHP

How to make a Photo Gallery in php?

Dear friends i try to make a Photo Gallery in my project in PHP language. Now i want to share the script and the process step by step. First of all i would like to give my cordial thanks to my honorable teacher Mr. Towhid Sir for give me the proper instruction.

Step-1

At first we create two table in the database. One is album_master and another is photo_album
CREATE TABLE `album_master` (
  `id` int(11) NOT NULL auto_increment,
  `albumName` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;


CREATE TABLE `photo_album` (
  `id` int(11) NOT NULL auto_increment,
  `album_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

Step-2

Now we need to write the following script for create Album Name. Here we just save a name in album_master table and further we retrieve the name. album_master.php

<?php
	$mgs="";
if(isset($_POST["btnAlbum"])){
		$albumName=$_POST["txtAlbumName"];
		
		include("../config.php");
		
		$db->query("INSERT INTO album_master(albumName)VALUES('$albumName')");
		$mgs="<div style="color:green">Photo Album Successfully Created</div>";
	}

?>

<div style="background-color:#347898; color:#fff; width:1008px; margin:0px auto; text-align:center; font-size:20px; font-weight:bold; padding:5px;">Create Album for Photo Archive </div>
<div style="width:1000px; height:auto; margin:0px auto; background:#FFF; padding:16px 0px 10px 16px;">

<form action="#" method="post" enctype="multipart/form-data">
	<div style="color:green; text-decoration:blink;"><?php echo $mgs; ?></div>
	<span style="font-weight:bold; font-size:16px;"> Album Name:</span>
 	<input type="text" name="txtAlbumName" required="required"/>
	<input type="submit" name="btnAlbum" value="Create Albam"/>
 </form>
</div>
The tutorial is going longer. Sorry friends no more today. Next time i describe how to send picture in a specific folder and crate a Thumbnail picture and save another folder. Good Night friends. I give the link where i use the gallery ... http://abcconvention.net/index.php?item=16 http://abcconvention.net/index.php?item=16 http://abcconvention.net/index.php?item=16 http://abcconvention.net/index.php?item=16

Comments 7


Copyright © 2026. Powered by Intellect Software Ltd