Img2

<?php
ini_set('mysql.connect_timeout',300);
ini_set('default_socket_timeout',300);
include('AdminSession.php');
?>

<html>
<head>

<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="img/WisdomIcon.jpg">

<!--JavaScript BootstrapFiles-->
        <script src="js\bootstrap.js"></script>
        <script src="js\bootstrap,mini.js"></script>
        <script src="js\jquery.min.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

       <!-- Bootstrap CSS -->
        <link href="css\bootstrap.css" rel="stylesheet">
        <link href="css\bootstrap.min.css" rel="stylesheet">
        <link href="css\bootstrap-theme.css" rel="stylesheet">
        <link href="css\bootstrap-theme.min.css" rel="stylesheet">

    <!-- Bootstrap core CSS -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> -->

<title>
<?php
include("title.php")
?>
</title>

<style>

h1, h3, h4
{
font-family: Times New Roman;
line-height: 180%;
text-align: left;
color:#353c47;
}

.thumbnail
{
height:300px;
width:350px;
text-align:center;
}

</style>

<?php
include("backtop.php")
?>

</head>

<?php
include("nav2logout.php")
?>

<?php
include("AdminNav.php")
?>

<body>

<div class="container"> <!-- Start Of The Container Class -->

<div class="row"> <!-- Start Of The Row Class -->

<div class="col-md-9 col-sm-4 hero-feature"> <!-- Start Of The Col Class -->

<h1> Customize Images Of The Site.</h1>

<form method="post" enctype="multipart/form-data">
<br>

Upload :<input type="file" name="image"/> <br>
<input type="submit" name="submit" value="Upload"/>

</form>

<?php

error_reporting(E_ALL ^ E_DEPRECATED);

if(isset($_POST['submit']))
{
if(getimagesize($_FILES['image']['tmp_name'])== FALSE)
{
echo "Plz slt";
}
else
{
$image=addslashes($_FILES['image']['tmp_name']);
$name= addslashes($_FILES['image']['name']);
$image= file_get_contents($image);
$image= base64_encode($image);
saveimage($name,$image);
}
}

function saveimage($name,$image)
{
$con=mysql_connect("localhost","root","");
mysql_select_db("a3075631_slsoc",$con);
$qry="insert into image (name,image) values ('$name','$image')";
$result=mysql_query($qry,$con);
if($result)
{
echo "<meta http-equiv='refresh' content='0;url=img2.php'>";
}
else
{
echo "<br><h1>Not Uploaded</h1>";
}
}

include('ksdb.php');
// get results from database
$result = mysql_query("SELECT * FROM image")
or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo '

<div class="col-md-4 col-sm-6 hero-feature">
    <div class="thumbnail">
        <img height="300" width="300" src="data:image;base64,'.$row['image'].'"> <br>
ID - '.$row['id'].' <br>
Name - '.$row['name'].' <br>
<a href="img2Update.php?id=' . $row['id'] . '">Update</a>
<a href="img2Del.php?id=' . $row['id'] . '">Delete</a>
      </div>
    </div>
';
}

?>

</div> <!-- End Of The Col Class -->

</div> <!-- End Of The Row Class -->

</div> <!-- End Of The Container Class -->

<!-- Footer -->
<?php
include("footer.php")
?><!-- End Of The Footer -->

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></script>

</body>
</html>

0 comments:

Folder Img

<?php

$dir_path = "flimg/";
$extensions_array = array('jpg','png','jpeg');

if(is_dir($dir_path))
{
    $files = scandir($dir_path);
   
    for($i = 0; $i < count($files); $i++)
    {
        if($files[$i] !='.' && $files[$i] !='..')
        {
            // get file name
            echo "File Name -> $files[$i]<br>";
           
            // get file extension
            $file = pathinfo($files[$i]);
            $extension = $file['extension'];
            echo "File Extension-> $extension<br>";
           
           // check file extension
            if(in_array($extension, $extensions_array))
            {
            // show image
            echo "<img src='$dir_path$files[$i]' style='width:100px;height:100px;'><br>";
            }

        }
    }
}

?>

0 comments:

DB Con

<?php

$host = 'localhost';
$user = 'root';
$pw = '';
$db = 'a3075631_slsoc';

$connection = mysql_connect($host,$user,$pw)

or die ("Couldnt Connect" .mysql_error());

mysql_select_db($db)

or die ("Couldnt Find DB" .mysql_error());

?>

0 comments:

Tweet Now !!

Recommend us on Google!