aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Photo
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-01-24 21:03:34 +0100
committerMario <mario@mariovavti.com>2021-01-24 21:03:34 +0100
commit552796286e4a2a61cc6020b7aa785dc88553e2d0 (patch)
tree943eee4b69d59d85062c3ac26319f622e013b751 /Zotlabs/Photo
parent6b0c61ac6bf45993f5d89b976c4d11c7e287aa38 (diff)
downloadvolse-hubzilla-552796286e4a2a61cc6020b7aa785dc88553e2d0.tar.gz
volse-hubzilla-552796286e4a2a61cc6020b7aa785dc88553e2d0.tar.bz2
volse-hubzilla-552796286e4a2a61cc6020b7aa785dc88553e2d0.zip
Add support filesystem storage for xchan profile photos
Diffstat (limited to 'Zotlabs/Photo')
-rw-r--r--Zotlabs/Photo/PhotoDriver.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php
index 94d2c3436..4c4f26e32 100644
--- a/Zotlabs/Photo/PhotoDriver.php
+++ b/Zotlabs/Photo/PhotoDriver.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Photo;
+use Zotlabs\Lib\Hashpath;
+
/**
* @brief Abstract photo driver class.
*
@@ -505,18 +507,25 @@ abstract class PhotoDriver {
* @return boolean
*/
public function storeThumbnail($arr, $scale = 0) {
-
- // We only process thumbnails here
- if($scale == 0)
- return false;
-
- $arr['imgscale'] = $scale;
-
- if(boolval(get_config('system','filesystem_storage_thumbnails', 0))) {
- $channel = channelx_by_n($arr['uid']);
+
+ // We only process thumbnails here
+ if($scale == 0)
+ return false;
+
+ $arr['imgscale'] = $scale;
+
+ if(boolval(get_config('system','photo_storage_type', 1))) {
+
$arr['os_storage'] = 1;
- $arr['os_syspath'] = 'store/' . $channel['channel_address'] . '/' . $arr['os_path'] . '-' . $scale;
- if(! $this->saveImage($arr['os_syspath']))
+
+ if (array_key_exists('uid', $arr) && ! in_array($scale, [ PHOTO_RES_PROFILE_300, PHOTO_RES_PROFILE_80, PHOTO_RES_PROFILE_48 ])) {
+ $channel = channelx_by_n($arr['uid']);
+ $arr['os_syspath'] = 'store/' . $channel['channel_address'] . '/' . $arr['os_path'] . '-' . $scale;
+ }
+ else
+ $arr['os_syspath'] = Hashpath::path($arr['resource_id'], 'store/[data]/[xchan]', 2, 1) . '-' . $scale;
+
+ if (! $this->saveImage($arr['os_syspath']))
return false;
}
else