From 4e0c1576475390faa2f1fb4c4dc2902a953f440e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 25 Feb 2009 12:16:53 +0000 Subject: First commit --- thumbnail.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 thumbnail.php (limited to 'thumbnail.php') diff --git a/thumbnail.php b/thumbnail.php new file mode 100644 index 000000000..0e6142cbb --- /dev/null +++ b/thumbnail.php @@ -0,0 +1,55 @@ +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 + + // Open error image if file was not found + if (!isset($contents) || is_null($contents) || $file->getSubtype()!='image') { + //$vars['url'].'mod/tidypics/graphics/img_error.jpg + forward('mod/tidypics/graphics/img_error.jpg'); + } //end of default error image + + // Return the thumbnail and exit + header("Content-type: image"); + echo $contents; + exit; +?> \ No newline at end of file -- cgit v1.2.3