1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require 'tiki-setup.php';
12
13$access->check_feature('feature_userPreferences');
14
15global $tikidomain;
16$userprefslib = TikiLib::lib('userprefs');
17// application to display an image from the database with
18// option to resize the image dynamically creating a thumbnail on the fly.
19// you have to check if the user has permission to see this gallery
20if (! isset($_REQUEST["user"])) {
21	die;
22}
23
24if (isset($_REQUEST['fullsize']) && $_REQUEST['fullsize'] == 'y' && $prefs["user_store_file_gallery_picture"] == 'y' && $user_picture_id = $userprefslib->get_user_picture_id($_REQUEST["user"])) {
25	header('Location: tiki-download_file.php?fileId=' . $user_picture_id . '&amp;display=y');
26	die;
27}
28
29$info = $userprefslib->get_user_avatar_img($_REQUEST["user"]);
30$type = $info["avatarFileType"];
31$content = $info["avatarData"];
32if (empty($content)) {
33	if ($prefs['user_default_picture_id']) {
34		header('Location: tiki-download_file.php?fileId=' . $prefs['user_default_picture_id'] . '&amp;display=y');
35		die;
36	} else {
37		$content = file_get_contents('img/noavatar.png');
38	}
39}
40header("Content-type: $type");
41echo $content;
42