Responsive Display Picture in Profile with Change Photo in PHP/MYSQLi

Responsive Display Picture in Profile with Change Photo in PHP/MYSQLi

Good day everyone. This tutorial entitled Responsive Display Picture in Profile with Change Photo in PHP/MYSQLi will teach you on creating a responsive display profile with a feature change photo for your profile page.

So let’s start now our tutorial.

So first, please download this. dp-design .

Extract the zip file. All the contents there are the CSS and javascript needed for a responsive display picture when it is clicked.

Now let’s proceed to the system codes.

Step by Step process to perform this project.

Step 1. First of all, create a database. Name it as any name you desire, in my case I choose “itsourcecode” as the name of the database.

Step 2. Then create a table, name it as “avatars” then put the following attributes.

CREATE TABLE `avatars` (
`ava_id` int(11) NOT NULL,
`ava_link` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

Step 3. For the connection to the database. Create a “conn.php” file then put the following codes.

<?php
$conn = new mysqli('localhost', 'root', '', 'itsourcecode');

if ($conn->connect_error) {
echo $conn->error;
}
?>

 

Step 4. On your profile page. Please put the following codes.

<?php
include 'conn.php';
?>

 

<html><html>    <head>        <meta charset="UTF-8">        <title>Responsive Profile</title>        <link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css"/>        http://assets/fancybox/jquery.fancybox-1.3.4.pack.js        <link href="assets/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" media="screen" type="text/css"/>        http://assets/slimbox/jquery.min.js        http://assets/slimbox/slimbox2.js        <link href="assets/slimbox/slimbox2.css" rel="stylesheet" type="text/css"/>                    $(document).ready(function() {            
$("#various1").fancybox({ 'titlePosition' : 'inside', 'transitionIn' : 'none', 'transitionOut' : 'none' });
$("#various2").fancybox();
$("#various3").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });
$("#various4").fancybox({ 'padding' : 0, 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'dissolve' }); $("#various5").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various6").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various7").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', }); $("#various8").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various9").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various10").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various11").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various12").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various13").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', }); });         <style>            body {                padding-top: 10px;            }            .ava {                background-color: #ffffff;                border: 1px solid #c0c0c0;            }        </style>    </head>    <body>

                                query("SELECT * FROM avatars ORDER BY ava_id DESC");                    $ava_data = $ava->fetch_assoc();                                        if ($ava->num_rows == null) {                        $ava_img = "images/user-ava.png";                    } else {                        $ava_img = $ava_data['ava_link'];                    }                ?>                                " rel="lightbox-gallery" title="">                   
" width="200px" class="ava"/>               

Change Photo

Name:	Harley F. Lumagui
Age:	19
Gender:	Male
Civil Status:	Single

</div>    </body></html>

 

Step 5. For changing a photo. Create a “change-photo.php” file then put the following codes.

<?php
include 'conn.php';
?>

<html>
<head>
<meta charset="UTF-8">
<title>Change Photo</title>
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<style>
body {
padding-top: 10px;
}
.ava {
background-color: #ffffff;
border: 1px solid #c0c0c0;
}
</style>
</head>
<body>

Your current avatar:

query("SELECT * FROM avatars ORDER BY ava_id DESC");
$ava_data = $ava->fetch_assoc();

if ($ava->num_rows == null) {
$ava_img = "images/user-ava.png";
} else {
$ava_img = $ava_data['ava_link'];
}
?>

" width="200px" class="ava"/>

query("INSERT INTO avatars (ava_link) VALUES ('$ava_link')");
if ($upload) {
header("Location: index.php");
} else {
echo $conn->error;
}
}
}
?>

</div>
</body>
</html>

 

Done.

When you complete this tutorial, you will be able to make your own social networking site like facebook. You can try to visit here the application of uploading the image in the user profile.

For more Resources of a complete system using PHP, you check it here PHP Projects with Source Code-free to Download.

Screenshots:

Inquiries

If you have questions regarding this tutorial entitled as Responsive Display Picture in Profile with Change Photo in PHP/MYSQLI” feel free to ask us by commenting below or visit on our contact page. Thank you.

Suggested Topics

Leave a Comment