Jump to content

Recommended Posts

Hello

 

i need to know how to create a script that can get someones picture from a file or db and display it like a avatar.

 

this is what i think i will do please corrent me if i am wrong

build a image up-loader when the image is uploaded store it in a var and the insert it into the db using a username from a log-in session. << that's the one i think will work but i don't have a clue about the file method where it gets uploaded to a file on the server and then is displayed when the user is logged in.

Link to comment
https://forums.phpfreaks.com/topic/163489-image-upload/
Share on other sites

options

#1. upload image to a folder, rename it to the usersID.jpg then have a field in the uers table called avatar set to usersID.jpg

#2. store the image in a blob in the database and then create a php file to emulate the image, ie

<?php
header('Content-Type: image/jpeg');
//connect to database
$SQL = sprintf("SELECT Image FROM table WHERE userid=%d LIMIT 1",$_GET['id']);
$r = mysql_query($SQL);
$row = mysql_fetch_row($r);
echo $row['Images'];
?>

Link to comment
https://forums.phpfreaks.com/topic/163489-image-upload/#findComment-862609
Share on other sites

THANK YOU

 

i didn't think it would be that simple i have only just started learning php over asp.net i am only sixteen and looking to get a job as a php program er you have just helped me to get even close now

 

1 more question is it safe to use session for getting users profile and pictures and things

Link to comment
https://forums.phpfreaks.com/topic/163489-image-upload/#findComment-862616
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.