]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
remove thumbnails if no longer needed
authorJeroen Dalsem <jdalsem@coldtrick.com>
Tue, 22 Oct 2013 14:46:06 +0000 (16:46 +0200)
committerJeroen Dalsem <jdalsem@coldtrick.com>
Tue, 22 Oct 2013 14:46:06 +0000 (16:46 +0200)
mod/file/actions/file/upload.php

index 7ee402121f17a3e6626e7eebcf68c8690e3799c2..e20c4079f7cac78c69290fa96d342feabe2d5277 100644 (file)
@@ -165,6 +165,23 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
                        $file->largethumb = $prefix."largethumb".$filestorename;
                        unset($thumblarge);
                }
+       } elseif ($file->icontime) {
+               // if it is not an image, we do not need thumbnails
+               unset($file->icontime);
+               
+               $thumb = new ElggFile();
+               
+               $thumb->setFilename($prefix . "thumb" . $filestorename);
+               $thumb->delete();
+               unset($file->thumbnail);
+               
+               $thumb->setFilename($prefix . "smallthumb" . $filestorename);
+               $thumb->delete();
+               unset($file->smallthumb);
+               
+               $thumb->setFilename($prefix . "largethumb" . $filestorename);
+               $thumb->delete();
+               unset($file->largethumb);
        }
 } else {
        // not saving a file but still need to save the entity to push attributes to database
@@ -202,4 +219,4 @@ if ($new_file) {
        }
 
        forward($file->getURL());
-}      
+}