aboutsummaryrefslogtreecommitdiff
path: root/thumbnail.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-06-20 19:22:35 +0000
committerCash Costello <cash.costello@gmail.com>2009-06-20 19:22:35 +0000
commit139964bcc7bc8c0fc4fd708d9df265e067049391 (patch)
treeb29324fcc7d8bd8c7e2bdaf1069ae0fbe0bd2691 /thumbnail.php
parent59b9d6b625884f5d47aae02671cfa77011005da2 (diff)
downloadelgg-139964bcc7bc8c0fc4fd708d9df265e067049391.tar.gz
elgg-139964bcc7bc8c0fc4fd708d9df265e067049391.tar.bz2
finished improving thumbnail code and replaced the old image error image
Diffstat (limited to 'thumbnail.php')
-rw-r--r--thumbnail.php26
1 files changed, 19 insertions, 7 deletions
diff --git a/thumbnail.php b/thumbnail.php
index 113262960..688d400af 100644
--- a/thumbnail.php
+++ b/thumbnail.php
@@ -16,15 +16,27 @@
if ($size != 'small' && $size != 'thumb') {
$size = 'large';
}
- error_log('size is ' . $size);
+
+ $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/img_error.jpg');
+ forward('mod/tidypics/graphics/' . $error_image);
if ($file->getSubtype() != "image")
- forward('mod/tidypics/graphics/img_error.jpg');
+ forward('mod/tidypics/graphics/' . $error_image);
// Get filename
if ($size == "thumb") {
@@ -34,10 +46,9 @@
} else {
$thumbfile = $file->largethumb;
}
- error_log('filename is ' . $thumbfile);
if (!$thumbfile)
- forward('mod/tidypics/graphics/img_error.jpg');
+ forward('mod/tidypics/graphics/' . $error_image);
// create Elgg File object
$readfile = new ElggFile();
@@ -47,11 +58,12 @@
// send error image if file could not be read
if (!$contents) {
- forward('mod/tidypics/graphics/img_error.jpg');
+ forward('mod/tidypics/graphics/' . $error_image);
}
// Return the thumbnail and exit
- header("Content-type: image");
+ $mime = $file->mimetype;
+ header("Content-type: $mime");
echo $contents;
exit;
?>