diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-01-08 15:23:36 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-01-08 15:23:36 -0500 |
commit | 3cba074d0597d36627500607ca4a0d7cd6a79b6e (patch) | |
tree | e48344ff223a13fec9bb4d9a24ca741078bebbc6 | |
parent | 62b03cd61f5b3c837a97e71260790c15be7e4ea2 (diff) | |
download | elgg-3cba074d0597d36627500607ca4a0d7cd6a79b6e.tar.gz elgg-3cba074d0597d36627500607ca4a0d7cd6a79b6e.tar.bz2 |
Fixes #2421 added icontime to files with thumbnails
-rw-r--r-- | mod/file/actions/file/upload.php | 8 | ||||
-rw-r--r-- | mod/file/start.php | 3 | ||||
-rw-r--r-- | 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 @@ <?php /** * Display an image + * + * @uses $vars['entity'] */ -$image_url = elgg_get_site_url() . "mod/file/thumbnail.php?file_guid={$vars['entity']->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 <<<HTML <div class="file-photo"> <a href="$download_url"><img class="elgg-photo" src="$image_url" /></a> |