diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-31 15:47:41 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-31 15:47:41 +0000 |
commit | cc8554abadc047469087fcd4f8f469ba733fceb0 (patch) | |
tree | a9837273d0142dfc649feb2b031158db4105a4f9 /mod/file/thumbnail.php | |
parent | 24ef7261d523155ee1c58e8297516e726b4ce80b (diff) | |
download | elgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.gz elgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.bz2 |
file index page now working for both users and groups
git-svn-id: http://code.elgg.org/elgg/trunk@7790 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/thumbnail.php')
-rw-r--r-- | mod/file/thumbnail.php | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/mod/file/thumbnail.php b/mod/file/thumbnail.php index 4da560a6c..35bf8c7f7 100644 --- a/mod/file/thumbnail.php +++ b/mod/file/thumbnail.php @@ -14,50 +14,44 @@ $file_guid = (int) get_input('file_guid', 0); // Get file thumbnail size $size = get_input('size', 'small'); -// Get file entity -if ($file = get_entity($file_guid)) { - - if ($file->getSubtype() == "file") { - - $simpletype = $file->simpletype; - if ($simpletype == "image") { - - // Get file thumbnail - switch ($size) { - case "small": - $thumbfile = $file->thumbnail; - break; - case "medium": - $thumbfile = $file->smallthumb; - break; - case "large": - default: - $thumbfile = $file->largethumb; - break; - } - - // Grab the file - if ($thumbfile && !empty($thumbfile)) { - $readfile = new ElggFile(); - $readfile->owner_guid = $file->owner_guid; - $readfile->setFilename($thumbfile); - $mime = $file->getMimeType(); - $contents = $readfile->grabFile(); - - // caching images for 10 days - header("Content-type: $mime"); - header('Expires: ' . date('r',time() + 864000)); - header("Pragma: public", true); - header("Cache-Control: public", true); - header("Content-Length: " . strlen($contents)); - - echo $contents; - exit; - - } - - } +$file = get_entity($file_guid); +if (!$file || $file->getSubtype() != "file") { + exit; +} + +$simpletype = $file->simpletype; +if ($simpletype == "image") { + + // Get file thumbnail + switch ($size) { + case "small": + $thumbfile = $file->thumbnail; + break; + case "medium": + $thumbfile = $file->smallthumb; + break; + case "large": + default: + $thumbfile = $file->largethumb; + break; + } + + // Grab the file + if ($thumbfile && !empty($thumbfile)) { + $readfile = new ElggFile(); + $readfile->owner_guid = $file->owner_guid; + $readfile->setFilename($thumbfile); + $mime = $file->getMimeType(); + $contents = $readfile->grabFile(); + + // caching images for 10 days + header("Content-type: $mime"); + header('Expires: ' . date('r',time() + 864000)); + header("Pragma: public", true); + header("Cache-Control: public", true); + header("Content-Length: " . strlen($contents)); + echo $contents; + exit; } - } |