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 --- graphics/empty_album.png | Bin 0 -> 1389 bytes graphics/image_error_large.png | Bin 0 -> 2208 bytes graphics/image_error_small.png | Bin 0 -> 2351 bytes graphics/image_error_thumb.png | Bin 0 -> 759 bytes graphics/img_error.jpg | Bin 5864 -> 0 bytes thumbnail.php | 26 +++++++++++++++++++------- views/default/object/album.php | 6 +++--- views/default/tidypics/albums.php | 4 ++-- 8 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 graphics/empty_album.png create mode 100644 graphics/image_error_large.png create mode 100644 graphics/image_error_small.png create mode 100644 graphics/image_error_thumb.png delete mode 100644 graphics/img_error.jpg diff --git a/graphics/empty_album.png b/graphics/empty_album.png new file mode 100644 index 000000000..0c041d0a2 Binary files /dev/null and b/graphics/empty_album.png differ diff --git a/graphics/image_error_large.png b/graphics/image_error_large.png new file mode 100644 index 000000000..4316f459d Binary files /dev/null and b/graphics/image_error_large.png differ diff --git a/graphics/image_error_small.png b/graphics/image_error_small.png new file mode 100644 index 000000000..2f814fd81 Binary files /dev/null and b/graphics/image_error_small.png differ diff --git a/graphics/image_error_thumb.png b/graphics/image_error_thumb.png new file mode 100644 index 000000000..0eeb797dc Binary files /dev/null and b/graphics/image_error_thumb.png differ diff --git a/graphics/img_error.jpg b/graphics/img_error.jpg deleted file mode 100644 index e3aad2aed..000000000 Binary files a/graphics/img_error.jpg and /dev/null differ 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; ?> diff --git a/views/default/object/album.php b/views/default/object/album.php index 1e8ff9dc9..eb26123e2 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -5,7 +5,7 @@ global $CONFIG; - $file = $vars['entity']; + $file = $vars['entity']; $file_guid = $file->getGUID(); $tags = $file->tags; $title = $file->title; @@ -14,7 +14,7 @@ $friendlytime = friendly_time($vars['entity']->time_created); $mime = $file->mimetype; - if (get_context() == "search") { + if (get_context() == "search") { if (get_input('search_viewtype') == "gallery") { //default gallery view for album listing @ /photos/owned/ @@ -23,7 +23,7 @@ if($file->cover) $album_cover = 'thumbnail'; else - $album_cover = 'new album'; + $album_cover = 'new album'; ?>