diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-04-07 22:48:33 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-04-07 22:48:33 +0200 |
commit | b026be410cc4b974d8e51af453fe3d15820e29ea (patch) | |
tree | b9ec62f4f0fdb1416a5fb542d310412ce6d292b1 /Zotlabs/Module | |
parent | 767a1711ff4cfafe1c81c6f1b73d10f55e2173c3 (diff) | |
parent | 4e12f86e909692e8aef203f2db001dcfa52410c9 (diff) | |
download | volse-hubzilla-b026be410cc4b974d8e51af453fe3d15820e29ea.tar.gz volse-hubzilla-b026be410cc4b974d8e51af453fe3d15820e29ea.tar.bz2 volse-hubzilla-b026be410cc4b974d8e51af453fe3d15820e29ea.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Photo.php | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 96a4e1f40..6912322aa 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -71,29 +71,32 @@ class Photo extends \Zotlabs\Web\Controller { $modified = filemtime($default); $default = z_root() . '/' . $default; $uid = $person; + + $data = ''; - $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ]; - call_hooks('get_profile_photo',$d); - - $resolution = $d['imgscale']; - $uid = $d['channel_id']; - $default = $d['default']; - $data = $d['data']; - $mimetype = $d['mimetype']; - + $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1", + intval($resolution), + intval($uid), + intval(PHOTO_PROFILE) + ); + if($r) { + $modified = strtotime($r[0]['edited'] . "Z"); + $mimetype = $r[0]['mimetype']; + if(intval($r[0]['os_storage'])) + $data = file_get_contents($data); + else + $data = dbunescbin($r[0]['content']); + } + if(! $data) { - $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1", - intval($resolution), - intval($uid), - intval(PHOTO_PROFILE) - ); - if($r) { - $modified = strtotime($r[0]['edited'] . "Z"); - $data = dbunescbin($r[0]['content']); - $mimetype = $r[0]['mimetype']; - } - if(intval($r[0]['os_storage'])) - $data = file_get_contents($data); + $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ]; + call_hooks('get_profile_photo',$d); + + $resolution = $d['imgscale']; + $uid = $d['channel_id']; + $default = $d['default']; + $data = $d['data']; + $mimetype = $d['mimetype']; } if(! $data) { |