aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/actions/file/upload.php8
-rw-r--r--mod/file/start.php7
-rw-r--r--mod/file/views/default/file/specialcontent/image/default.php10
3 files changed, 18 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 8c8883b6e..6c1501bd2 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -237,6 +237,10 @@ function file_get_simple_type($mimetype) {
return $type;
}
+ if($type = elgg_trigger_plugin_hook('file_simple_type', 'object', $params, null)) {
+ return $type;
+ }
+
switch ($mimetype) {
case "application/msword":
return "document";
@@ -349,7 +353,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>