Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by White_Lily

  1. and AyKay47, its the php that calculates the numbers needed for the styles of the avatars, and since the problem is with the php calculations and not the css then this is therefore a php problem and stays here.

  2. The size of the image you see on the website is 166(width) by 132(height).

     

    Im not sure how the website managed to figure out 83px margins since whne i figured it out paper i got 17px (margin-top)... (I used the same equations as the website is using.

  3. winningdave good logic however the only problem with that is that if read is set to 0 then both users would see it as unread, and if it was set to 1 both users would see it as read, even if one of the users has NOT read the message.

  4. Okay so i did what you said and it works, but now I have a slightly new problem.

     

    Here is the uploading code:

    <?php 
    
    					$newdir = $dir."/uploads/";
    
    					if(!empty($_POST['imgsubmit'])){ 
    						if (isset ($_FILES['new_image'])){ 
    							$imagename = $_FILES['new_image']['name'];
    							$parts = explode( '.', $imagename );
    							$extension = strtolower( $parts['1'] );
    							$new_filename = uniqid().".".$extension;
    							$source = $_FILES['new_image']['tmp_name']; 
    							$target = $doc.$new_filename; 
    							move_uploaded_file($source, $target); 
    
    							$imagepath = $new_filename; 
    							$save = $doc.$imagepath; //This is the new file you saving 
    							$file = $doc.$imagepath; //This is the original file 
    
    							list($width, $height) = getimagesize($file) ;  
    
    							$modwidth = 166;  
    
    							$diff = $width / $modwidth; 
    
    							$modheight = $height / $diff;  
    							$tn = imagecreatetruecolor($modwidth, $modheight) ;  
    							$image = imagecreatefromjpeg($file) ;  
    							imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;  
    
    							imagejpeg($tn, $save, 100) ;
    
    							if(!empty($imagepath)){
    
    								$imageavi = $dir2.$imagepath;
    
    								$changeavi = update("users", "avatar = '$imageavi'", "username = '$u'") or die(mysql_error());
    								if($changeavi){
    									echo "Avatar Changed!";
    								}
    							}
    
    						} 
    					} 
    				?>

     

    The new problem I have is on the profile page:

    $getbg = select("*", "users", "username = '$u'");
    $bg = mysql_fetch_assoc($getbg);
    $pic = $bg["background"];
    $propicmargin = $bg["avatar"];
    if($propicmargin){
    list($width, $height) = getimagesize($propicmargin);
    
    /*//Calculates Height of images that have an exact width of the box.
    if($width == 166){
    $margin = 166-$height;
    $margin = $margin/2;
    if($margin < 0){ $margin = 0; }
    }*/
    
    //Calculates Width & Height of small images to find the margin left & top.
    if($width < 166 && $height < 166){
    $margin = 166-$height;
    $margin = $margin/2;
    if($margin <= 0){ $margin = 0; }
    $marginw = 166-$width;
    $marginw = $marginw/2;
    if($marginw <= 0){ $marginw = 0; }
    }
    
    $avatar = '<img src="'.$propicmargin.'" />';
    
    }else{
    $avatar = '<img src="'.$GLOBALS["nav"].'images/avatar.png" />';
    }

     

    To see the actual problem I am having:

     

    http://janedealsart.co.uk/social

     

    User: Guest

    Pass: Guest657

  5. Sorry forgot to post those lol

    Here they are:

     

    Warning: move_uploaded_file(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploads) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 76

     

     

     

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpU6IZwg' to '/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploads' in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 76

     

     

     

     

    Warning: getimagesize(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploadsGuildWars2-Guardian-GW2.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 82

     

     

     

     

    Warning: Division by zero in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 88

     

     

     

     

    Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 89

     

     

     

     

    Warning: imagecreatefromjpeg(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploadsGuildWars2-Guardian-GW2.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 90

     

     

     

     

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 91

     

     

     

     

    Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 93

  6. Im getting lots of errors on my image uploading script, but i can't figure out why they are showing, the filepath and names are correct.

     

    $doc Variable:

    $doc = $_SERVER['DOCUMENT_ROOT']."social/users/".$u."/uploads/";

     

    Upload Code:

    <form action="" method="POST" enctype="multipart/form-data"> 
    						<input name="new_image" type="file" class="input" /> 
    						<input name="imgsubmit" type="submit" class="buttons" value="Upload" />
    				</form> 
    				<?php 
    
    						$newdir = $dir."/uploads/";
    
    						if(!empty($_POST['imgsubmit'])){ 
    						  if (isset ($_FILES['new_image'])){ 
    							  $imagename = $_FILES['new_image']['name']; 
    							  $source = $_FILES['new_image']['tmp_name']; 
    							  $target = $doc; 
    							  move_uploaded_file($source, $target); 
    				  
    							  $imagepath = $imagename; 
    							  $save = $doc.$imagepath; //This is the new file you saving 
    							  $file = $doc.$imagepath; //This is the original file 
    				  
    							  list($width, $height) = getimagesize($file) ;  
    				  
    							  $modwidth = 500;  
    				  
    							  $diff = $width / $modwidth; 
    				  
    							  $modheight = $height / $diff;  
    							  $tn = imagecreatetruecolor($modwidth, $modheight) ;  
    							  $image = imagecreatefromjpeg($file) ;  
    							  imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;  
    				  
    							  imagejpeg($tn, $save, 100) ;
    							  
    							echo "Large image: <img src='".$newdir.$imagepath."'><br>";
    				  
    						  } 
    						} 
    				?>

  7. Um, tbh - if i knew how to go about doing it, I wouldn't be posting here... would I?

     

    Ass in, what does my database need in it as all it has at the moment is the simple things like; content, message id, from, to, subject... what else is needed?

    Maybe give me some links to look at or some sample code that I can build on, I have tried looking on the internet but nothing seems to do what I need it to do.

  8. how can you explain a read/unread system for an inbox?

     

    A user has either read a message, or not read a message, however when a user sends a message to another, the receiver needs to see it as unread... im not entirely sure how else to explain it...

  9. Hi I have created an inbox system, but i want to implement a read/unread system.

     

    Messages would consist of 2 people always. (Sender & Receiver).

     

    I was wondering how I would go about this.

     

     

    (I would like to avoid javascript / jquery if possible)

  10. This is how I am doing my registration forms at the moment, however it requires 1 error message for all the empties it finds.

     

    if($_POST["submitReg"]){
    $validateArray = array("name" => "text", "email" => "email");
    
    foreach($validateArray as $key => $value)
    {
    if($value == "text")
    $$key = htmlspecialchars(mysql_real_escape_string($_POST[$key]));
    else
    $$key = mysql_real_escape_string($_POST[$key]);
    
    if(empty($$key))
    {
    
    }
    }
    }

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