]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2421 added icontime to files with thumbnails
authorCash Costello <cash.costello@gmail.com>
Sun, 8 Jan 2012 20:23:36 +0000 (15:23 -0500)
committerCash Costello <cash.costello@gmail.com>
Sun, 8 Jan 2012 20:23:36 +0000 (15:23 -0500)
mod/file/actions/file/upload.php
mod/file/start.php
mod/file/views/default/file/specialcontent/image/default.php

index 3edc87952a10da7cadf9cb283198622ba4dcbeca..5242cbda2c748752ef741837648616950b35183c 100644 (file)
@@ -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");
index e15a9ad612147c2c3cbd16dbd70900a4c6a70c3f..36142533f9333a7af638a4a193d0208ef5a475fe 100644 (file)
@@ -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(
index fbd994a0b22f7b2c65e3e1b07af7aa049e1c7282..431ac9f4f5737671d179a4d70292f4bd41711e51 100644 (file)
@@ -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>