Uploading Profile Photo of a memberMembers can add or update their photo to their membership account. This is popularly known as profile photo. We will learn how to add profile photo by a member.
This script is a part of membership management script so profile photo can be added or updated by the member after login. Here there is a membership table where all details of the member is stored. You can see the structure of the membership table here.
Watch the last column where we store the file name.
Unique file nameEach member profile photo is stored in a common folder so the file names are to be unique. Each member has one unique member id and user id. Hence we will store the file name along with the member id. For example for user id plus2net member id is 4. Hence the file name will be 4.jpg
You can add userid also to the file name. like plus2net.jpg
Where to store the profile pictures.In the root of the script there is a folder profile-photo. Here we are uploading all images and storing profile photo. If you want to change the folder then it can be done inside memadmin area two different files used for uploading photo.
You must give write permission to this folder to enable file upload.
How members can add profile photoAfter login member can go to memadmin area saying settings. From memadmin area there are two links, one is to update profile and one more to update or add profile photo.
On visiting the profile photo page , the old profile photo page if already added will be displayed below the upload photo button. Here user can use the upload button to select a new profile photo from its computer. On Clicking the choose file button user can browse local computer files and select an image of jpg or gif type. Other file type are not allowed.
Once uploaded the file extension is checked for gif or jpg type images otherwise file is deleted.
After uploading the script check the dimensions of image and they are reduced proportionately to the required size.
you can read more on resizing images after uploading here.
Once the resizing of images are over it is time to update the record with new file name. In our member table we store details of each member. For profile picture we have a column profile_photo. We will update this column with our new file name.
We will take member id which is unique and is present as session variable for updating record in where clause.
Here is the code for updating record with pfile photo. Note that we are not storing the photo in the table but storing the file name against member record.
How to check script or add profile photoDownload the script and install the database file. Inside Memadmin directory there are two files, profile-photo.php & profile-photock.php.
This is a part of Membership Management Script.
Script partThere are two files, one is profile-photo.php and other one is profile-photock.php.
profile-photo.phpThis file show the upload button and handle the form. Here is the code
profile-photock.phpThis file upload the photo and place them in a directory after resizing it. Here is the code.
PHP Session: Creating , using destroying Session variables PHP Session ID: generating session id and re-generating Online membership management script Posting Activation key for lost encrypted password to the email address Creating a signup page and storing member details in MySQL Storing signup data in a table Changing or updating password by the logged in member Forgot password feature in member signup script Basic login form Login script to authenticate user from a mysql table data Checking the status of user for login or logged out Updating member profile inside member area Adding Profile Photo by Members after login Finding out who are online