tiki-show_user_avatar.php 1.37 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
6
// 
7 8
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
9 10
// $Id$

11
require 'tiki-setup.php';
12 13 14

$access->check_feature('feature_userPreferences');

15 16
global $tikidomain;
$userprefslib = TikiLib::lib('userprefs');
changi67's avatar
changi67 committed
17
// application to display an image from the database with
lrargerich's avatar
lrargerich committed
18 19
// option to resize the image dynamically creating a thumbnail on the fly.
// you have to check if the user has permission to see this gallery
20 21
if (!isset($_REQUEST["user"])) {
	die;
lrargerich's avatar
lrargerich committed
22
}
23 24 25 26 27 28

if (isset($_REQUEST['fullsize']) && $_REQUEST['fullsize'] == 'y' && $prefs["user_store_file_gallery_picture"] == 'y' && $user_picture_id = $userprefslib->get_user_picture_id($_REQUEST["user"]) ) {
	header('Location: tiki-download_file.php?fileId=' . $user_picture_id . '&amp;display=y');
	die;
}

29
$info = $userprefslib->get_user_avatar_img($_REQUEST["user"]);
lrargerich's avatar
lrargerich committed
30 31
$type = $info["avatarFileType"];
$content = $info["avatarData"];
32
if (empty($content)) {
33 34 35 36 37 38
	if($prefs['user_default_picture_id']){
		header('Location: tiki-download_file.php?fileId=' . $prefs['user_default_picture_id'] . '&amp;display=y');
	die;
	} else {
		$content = file_get_contents('img/noavatar.png');
	}
39
}
changi67's avatar
changi67 committed
40
header("Content-type: $type");
41
echo $content;
42