Page 1 of 1

Avatar Upload Tutorial - Syntax Error

Posted: Tue Nov 29, 2011 4:27 am
by Zoomer
Hello,

Currently following the avatar upload tutorial, and I've gotten an error.

"Parse error: syntax error, unexpected '=' in user.inc.php on line 92"


user.inc (Line 27 in the following code)
// Updates the current user's profile info
function set_profile_info($email, $about, $location, $avatar){
    $email = mysql_real_escape_string(htmlentities($email));
    $about = mysql_real_escape_string(nl2br(htmlentities($about)));
    $location = mysql_real_escape_string($location);
	
	if (file_exists($avatar)){
	    $src_size = getimagesize($avatar);
		
	    if ($src_size['mime'] === 'image/jpeg'){
		    $src_img = imagecreatefromjpeg($avatar);
		}else if ($src_size['mime'] === 'image/png'){
            $src_img = imagecreatefrompng($avatar);	
        }else if ($src_size['mime'] === 'image/gif'){
            $src_img = imagecreatefromgif($avatar);	
        }else{
            $src_img = false;
        }

        if (src_img !== false){
            $thumb_width = 200;
			
			if ($src_size[0] <= $thumb_width){
			    $thumb = $src_img;
			}else{
                $new_size[0] = $thumb_width;
                $new_size[1] = ($src_size[1] / $src_size[0]) = $thumb_width;

                $thumb = imagecreatetruecolor($new_size[0], new_size[1]);
                imagecopyresampled($thumb, $src_img, 0, 0, 0, 0, $new_size[0], $new_size[1], $src_size[0], $src_size[1]);
            }
            
            imagejpeg($thumb, "{$GLOBALS['path']}/user_avatars/{$_SESSION['uid']}.jpg");			
        }		
}
        
    $sql = "UPDATE `users` SET
                `user_email` = '{$email}',
                `user_about` = '{$about}',
                `user_location` = '{$location}'
            WHERE `user_id` = {$_SESSION['uid']}";
                
    mysql_query($sql);
}

Once again, any help would be appreciated.


*EDIT

I fixed my problem. I had an '=' instead of an *. Also missed a '$', on another line.