-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathavatar.php
More file actions
38 lines (31 loc) · 910 Bytes
/
avatar.php
File metadata and controls
38 lines (31 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
** Avatar retrieval function for SocialProfile avatars in MediaWiki
** @author George Barnick <george.barnick@brickcraft.me>
*/
// Location to avatars on-server (may need to be changed periodically)
$directory = "/var/www/images/avatars/";
// The file to be displayed
$file = "";
// The file header type
$type = "image/";
if ( $_GET["id"] ) {
$userID = $_GET["id"];
} else {
$userID = $_COOKIE["sharedUserID"];
}
if ( file_exists( $directory . $userID . "_l.png" ) ) {
$file = $directory . $userID . "_l.png";
$type .= "png";
} elseif ( file_exists( $directory . $userID . "_l.jpg" ) ) {
$file = $directory . $userID . "_l.jpg";
$type .= "jpeg";
} elseif ( file_exists( $directory . $userID . "_l.gif" ) ) {
$file = $directory . $userID . "_l.gif";
$type .= "gif";
} else {
$file = $directory . "default_l.gif";
$type .= "gif";
}
header( 'Content-Type:' . $type );
readfile( $file );