From 139964bcc7bc8c0fc4fd708d9df265e067049391 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 20 Jun 2009 19:22:35 +0000 Subject: finished improving thumbnail code and replaced the old image error image --- thumbnail.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'thumbnail.php') 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; ?> -- cgit v1.2.3