aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Storage/Browser.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-19 17:39:19 -0800
committerzotlabs <mike@macgirvin.com>2017-11-19 17:39:19 -0800
commit4cd0b745cbc24a035a5e9ba488917ec7beeda888 (patch)
treefaad8cf0e7ef2a720ce002e6b280ae31a77971d0 /Zotlabs/Storage/Browser.php
parentcf4588f16fbe6dc55eabdb590480bc88d560dad3 (diff)
parent88d0bf94d89ac739469528bdab7905d0c00cf8a9 (diff)
downloadvolse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.tar.gz
volse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.tar.bz2
volse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Storage/Browser.php')
-rw-r--r--Zotlabs/Storage/Browser.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index b5440aacf..17b07ad82 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -197,7 +197,16 @@ class Browser extends DAV\Browser\Plugin {
}
}
+
+ // generate preview icons for tile view.
+ // Currently we only handle images, but this could potentially be extended with plugins
+ // to provide document and video thumbnails. SVG, PDF and office documents have some
+ // security concerns and should only be allowed on single-user sites with tightly controlled
+ // upload access. system.thumbnail_security should be set to 1 if you want to include these
+ // types
+
$photo_icon = '';
+ $preview_style = intval(get_config('system','thumbnail_security',0));
if(strpos($type,'image/') === 0 && $attachHash) {
$r = q("select resource_id, imgscale from photo where resource_id = '%s' and imgscale in ( %d, %d ) order by imgscale asc limit 1",
@@ -206,10 +215,19 @@ class Browser extends DAV\Browser\Plugin {
intval(PHOTO_RES_PROFILE_80)
);
if($r) {
- $photo_icon = $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
+ $photo_icon = 'photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
+ }
+ if($type === 'image/svg+xml' && $preview_style > 0) {
+ $photo_icon = $fullPath;
}
+
}
+ $g = [ 'resource_id' => $attachHash, 'thumbnail' => $photo_icon, 'security' => $preview_style ];
+ call_hooks('file_thumbnail', $g);
+ $photo_icon = $g['photo_icon'];
+
+
$attachIcon = ""; // "<a href=\"attach/".$attachHash."\" title=\"".$displayName."\"><i class=\"fa fa-arrow-circle-o-down\"></i></a>";
// put the array for this file together