This repository was archived by the owner on Nov 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathicon.php
More file actions
50 lines (41 loc) · 1.37 KB
/
icon.php
File metadata and controls
50 lines (41 loc) · 1.37 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Elgg itemicon icon page
*
* @package ElggItemIcon
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Diego Andrés Ramírez Aragón <dramirezaragon@gmail.com>
* @copyright Corporación Somos más - 2009; Diego Andrés Ramírez Aragón 2010
* @link http://github.com/lowfill/itemicon
*
* @uses get_input("item_guid")
* @uses get_input("size")
*/
global $CONFIG;
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$item_guid = get_input('item_guid');
$item = get_entity($item_guid);
$size = strtolower(get_input('size'));
if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
$size = "medium";
$success = false;
$filehandler = new ElggFile();
$filehandler->owner_guid = $item->owner_guid;
$filehandler->setFilename("icons/{$item->guid}-{$item->title}{$size}.jpg");
$success = false;
if ($filehandler->open("read")) {
if ($contents = $filehandler->read($filehandler->size())) {
$success = true;
}
}
//@todo Add suppor for default icons per type
if (!$success) {
$contents = @file_get_contents($CONFIG->pluginspath . "items/graphics/default{$size}.jpg");
}
header("Content-type: image/jpeg");
header('Expires: ' . date('r',time() + 864000));
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: " . strlen($contents));
echo $contents;
?>