aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorJuho Jaakkola <juho.jaakkola@mediamaisteri.com>2013-11-29 05:22:17 -0800
committerJuho Jaakkola <juho.jaakkola@mediamaisteri.com>2013-11-29 05:22:17 -0800
commitad8aff634c5c391042484aa9c8129e59faeac093 (patch)
treec79bce2e17c3a15549a4f2fb5fa8e668cb30d91d /mod
parent55c39ae0980bced8a03739fc25c6d876979d3572 (diff)
parent0d3c2bcf71a493cb5b0923227a2b043a09762fdb (diff)
downloadelgg-ad8aff634c5c391042484aa9c8129e59faeac093.tar.gz
elgg-ad8aff634c5c391042484aa9c8129e59faeac093.tar.bz2
Merge pull request #6164 from jdalsem/file-remove-thumbs
Fixes #6162 - Remove file thumbnails if no longer needed
Diffstat (limited to 'mod')
-rw-r--r--mod/file/actions/file/upload.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index 7ee402121..e20c4079f 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -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());
-}
+}