From 450b57bc95f405aebb1dc110bafc1b5def5041f4 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Mar 2009 15:57:48 +0000 Subject: code cleanup --- thumbnail.php | 60 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) (limited to 'thumbnail.php') diff --git a/thumbnail.php b/thumbnail.php index 0e6142cbb..b4c745ae2 100644 --- a/thumbnail.php +++ b/thumbnail.php @@ -1,46 +1,42 @@ getSubtype() == "image") { - // Get file thumbnail - if ($size == "small") { - $thumbfile = $file->smallthumb; - } else { - $thumbfile = $file->largethumb; - } + if ($file = get_entity($file_guid)) { + if ($file->getSubtype() == "image") { + // Get file thumbnail + if ($size == "small") { + $thumbfile = $file->smallthumb; + } else { + $thumbfile = $file->largethumb; + } - // 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(); - } - } //end subtype comparison - } //end get_entity + // 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(); + } + } //end subtype comparison + } //end get_entity // Open error image if file was not found if (!isset($contents) || is_null($contents) || $file->getSubtype()!='image') { @@ -49,7 +45,7 @@ } //end of default error image // Return the thumbnail and exit - header("Content-type: image"); - echo $contents; - exit; + header("Content-type: image"); + echo $contents; + exit; ?> \ No newline at end of file -- cgit v1.2.3