From 552796286e4a2a61cc6020b7aa785dc88553e2d0 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 24 Jan 2021 21:03:34 +0100 Subject: Add support filesystem storage for xchan profile photos --- Zotlabs/Lib/Hashpath.php | 55 +++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Module/Photo.php | 6 ++--- Zotlabs/Photo/PhotoDriver.php | 31 +++++++++++++++--------- 3 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 Zotlabs/Lib/Hashpath.php (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Hashpath.php b/Zotlabs/Lib/Hashpath.php new file mode 100644 index 000000000..f3b25d2b6 --- /dev/null +++ b/Zotlabs/Lib/Hashpath.php @@ -0,0 +1,55 @@ +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 -- cgit v1.2.3