aboutsummaryrefslogtreecommitdiff
path: root/thumbnail.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-12-12 19:51:49 +0000
committerCash Costello <cash.costello@gmail.com>2009-12-12 19:51:49 +0000
commit621177abc2bc60e9edb3ca723a4afaa9d9e713ef (patch)
treed6064f1fe767d042ea41e4adea88e57b8e5138ff /thumbnail.php
parentb40060fafaba46e2fb8800b2c2e557a8c6bde9db (diff)
downloadelgg-621177abc2bc60e9edb3ca723a4afaa9d9e713ef.tar.gz
elgg-621177abc2bc60e9edb3ca723a4afaa9d9e713ef.tar.bz2
convert line endings to Unix
Diffstat (limited to 'thumbnail.php')
-rw-r--r--thumbnail.php156
1 files changed, 78 insertions, 78 deletions
diff --git a/thumbnail.php b/thumbnail.php
index f310aee95..79d487210 100644
--- a/thumbnail.php
+++ b/thumbnail.php
@@ -1,78 +1,78 @@
-<?php
-
- /**
- * Tidypics Thumbnail
- *
- */
-
- include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- // Get file GUID
- $file_guid = (int) get_input('file_guid');
-
- // Get file thumbnail size
- $size = get_input('size');
- // only 3 possibilities
- if ($size != 'small' && $size != 'thumb') {
- $size = 'large';
- }
-
- $error_image = '';
- switch ($size) {
- case 'thumb':
- $error_image = "image_error_thumb.png";
- break;
- case 'small':
- $error_image = "image_error_small.png";
- break;
- case 'large':
- $error_image = "image_error_large.png";
- break;
- }
-
- // Get file entity
- $file = get_entity($file_guid);
- if (!$file)
- forward('mod/tidypics/graphics/' . $error_image);
-
- if ($file->getSubtype() != "image")
- forward('mod/tidypics/graphics/' . $error_image);
-
- // Get filename
- if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
- } else if ($size == "small") {
- $thumbfile = $file->smallthumb;
- } else {
- $thumbfile = $file->largethumb;
- }
-
- if (!$thumbfile)
- forward('mod/tidypics/graphics/' . $error_image);
-
- // create Elgg File object
- $readfile = new ElggFile();
- $readfile->owner_guid = $file->owner_guid;
- $readfile->setFilename($thumbfile);
- $contents = $readfile->grabFile();
-
- // send error image if file could not be read
- if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
- }
-
- // expires every 14 days
- $expires = 14 * 60*60*24;
-
- // overwrite header caused by php session code so images can be cached
- $mime = $file->getMimeType();
- header("Content-Type: $mime");
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
- // Return the thumbnail and exit
- echo $contents;
- exit;
-?>
+<?php
+
+ /**
+ * Tidypics Thumbnail
+ *
+ */
+
+ include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // Get file GUID
+ $file_guid = (int) get_input('file_guid');
+
+ // Get file thumbnail size
+ $size = get_input('size');
+ // only 3 possibilities
+ if ($size != 'small' && $size != 'thumb') {
+ $size = 'large';
+ }
+
+ $error_image = '';
+ switch ($size) {
+ case 'thumb':
+ $error_image = "image_error_thumb.png";
+ break;
+ case 'small':
+ $error_image = "image_error_small.png";
+ break;
+ case 'large':
+ $error_image = "image_error_large.png";
+ break;
+ }
+
+ // Get file entity
+ $file = get_entity($file_guid);
+ if (!$file)
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ if ($file->getSubtype() != "image")
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // Get filename
+ if ($size == "thumb") {
+ $thumbfile = $file->thumbnail;
+ } else if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+ } else {
+ $thumbfile = $file->largethumb;
+ }
+
+ if (!$thumbfile)
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // create Elgg File object
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($thumbfile);
+ $contents = $readfile->grabFile();
+
+ // send error image if file could not be read
+ if (!$contents) {
+ forward('mod/tidypics/graphics/' . $error_image);
+ }
+
+ // expires every 14 days
+ $expires = 14 * 60*60*24;
+
+ // overwrite header caused by php session code so images can be cached
+ $mime = $file->getMimeType();
+ header("Content-Type: $mime");
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+ // Return the thumbnail and exit
+ echo $contents;
+ exit;
+?>