Welcome Guest, Not a member yet? Register   Sign In
A simple get avatar function
#11

[eluser]Twisted1919[/eluser]
Try this :
Code:
function getAvatar($userid)
    {
        $extensions = array('.jpeg', '.jpg', '.png', '.gif');
        foreach ($extensions as $extension)
        {
            $check_this_name = $userid.$extension;
            $dest = FCPATH.'avatars/'. $check_this_name;
            if (file_exists($dest))
            {
                return $check_this_name;
            }
        }
    return FALSE ;
    }
#12

[eluser]danmontgomery[/eluser]
with file_exists() use a system path, not a web path.

/var/www/path/to/file.gif rather than http://www.mydomain.com/path/to/file.gif
#13

[eluser]Iwasignited[/eluser]
thanks guys. It worked with
Code:
$dest = FCPATH.'avatars/'. $check_this_name;




Theme © iAndrew 2016 - Forum software by © MyBB