From 3cba074d0597d36627500607ca4a0d7cd6a79b6e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 15:23:36 -0500 Subject: Fixes #2421 added icontime to files with thumbnails --- mod/file/actions/file/upload.php | 8 +++++--- mod/file/start.php | 3 ++- mod/file/views/default/file/specialcontent/image/default.php | 10 +++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 3edc87952..5242cbda2 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -109,7 +109,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { // if image, we need to create thumbnails (this should be moved into a function) if ($guid && $file->simpletype == "image") { - $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); + $file->icontime = time(); + + $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true); if ($thumbnail) { $thumb = new ElggFile(); $thumb->setMimeType($_FILES['upload']['type']); @@ -123,7 +125,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbnail); } - $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); + $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true); if ($thumbsmall) { $thumb->setFilename($prefix."smallthumb".$filestorename); $thumb->open("write"); @@ -133,7 +135,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbsmall); } - $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); + $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false); if ($thumblarge) { $thumb->setFilename($prefix."largethumb".$filestorename); $thumb->open("write"); diff --git a/mod/file/start.php b/mod/file/start.php index e15a9ad61..36142533f 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -345,7 +345,8 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { // thumbnails get first priority if ($file->thumbnail) { - return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size"; + $ts = (int)$file->icontime; + return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size&icontime=$ts"; } $mapping = array( diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php index fbd994a0b..431ac9f4f 100644 --- a/mod/file/views/default/file/specialcontent/image/default.php +++ b/mod/file/views/default/file/specialcontent/image/default.php @@ -1,13 +1,17 @@ getGUID()}&size=large"; +$file = $vars['entity']; + +$image_url = $file->getIconURL('large'); $image_url = elgg_format_url($image_url); -$download_url = elgg_get_site_url() . "mod/file/download.php?file_guid={$vars['entity']->getGUID()}"; +$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}"; -if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) { +if ($vars['full_view']) { echo << -- cgit v1.2.3