Jump to content

uploading picture


runnerjp

Recommended Posts

hey guys... a quickie

 

is there away i can let users upload images and then have them set as there profile picture for every 1 to see??

 

you know like myspace or facebook all these popular profile sites or like on here the avatars.... i say is there away obviously there is,,, i should by saying how?? lol

Link to comment
https://forums.phpfreaks.com/topic/50042-uploading-picture/
Share on other sites

Extremely easy using a MySQL database. Assuming you have a users table where you store a unique identifier, you simply tie that image to the particular user. This requires only a minimal understanding of PHP/MySQL so I suggest running through some quick tutorials with working examples. I don't think giving you code would help.

Link to comment
https://forums.phpfreaks.com/topic/50042-uploading-picture/#findComment-245638
Share on other sites

This is done in a very easy fashion, byt I agree with Ceasar, providing code here would only hinder your learning process.

 

I will give you an idea of how I did it. I have a fully database driven application for church directories, attendence, service information, family directories, individual profiles, etc etc. Each image is in the Images/profiles/pics/ directory, and the image file name is the person's database ID number, which is always unique, .jpg. Or, the person who's ID number is 365, their profile images is 365.jpg.

 

When the file is uploaded, it is moved to Images/profiles/pics/365.jpg. Any time their profile page is opened, PHP checks to see if the file is available, with if(fileexists(...path/to/image)).

 

Hope that helps a little. In cases like this, it is really unique to your style and application.

Link to comment
https://forums.phpfreaks.com/topic/50042-uploading-picture/#findComment-245642
Share on other sites

<?
		$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
		$sql = "SELECT * FROM $tbl_images WHERE directory = \"$directory\" AND default_pic = \"yes\"";
		$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
		$PICSnum=mysql_num_rows($result);
		while ($row = mysql_fetch_array($result)) {
		$url = $row['url'];
		$image = $row['image'];
		}
		if(empty($url)) {$newurl="$imgdir";}else{$newurl="$userdir/$url";}
		if(empty($image))$image="pic.gif";
		$showimg="/$newurl/$image";
            ?>
            <script type="text/javascript">
		function openpopup(popurl){
		var winpops=window.open(popurl,"","width=610px,height=625px,resizable")
		}
            </script>
            <p align="center">
             <a href="javascript:openpopup('showpic.php?img=<?echo $image ?>')"><IMG SRC="../../thumbs/phpThumb.php?src=<?echo $showimg ?>&w=150" border="0"></a>
             <?
             if($PICSnum > "0") {
             ?>
             <br><a href="<?echo $PHP_SELF ?>?action=pics">My Pictures >></a>
             <? }
                        if($profile_id == $auth[member_id]){
                        echo "<br><a href=\"$userurl/upload.php\">upload picture</a>";
                        
                        ?>

 

thought summats like this but nothing appears on screen but pic.gif thats set as a default pic not the uploaded 1 from the table

Link to comment
https://forums.phpfreaks.com/topic/50042-uploading-picture/#findComment-246227
Share on other sites

image_id    directory    image    url    displayname    default_pic

 

 

thats what my database is holding.... basicly what i wanna do is get the image from the members id the is loged in at the present time... shouldent this do it...

 

 

so i have someing like this

 

image_id directory                                                 image  url displayname default_pic

00000001  /home/runnerse/public_html/users/Admin  test.jpg  Admin    Admin              yes

Link to comment
https://forums.phpfreaks.com/topic/50042-uploading-picture/#findComment-246265
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.