diff options
author | zotlabs <mike@macgirvin.com> | 2016-10-17 22:09:41 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-10-17 22:09:41 -0700 |
commit | 17091bd38c4e4e5d8b1812dd1d9efeffe0046d02 (patch) | |
tree | 74a4d72846767c58d26b113b14de3da4dd0fb0c0 /Zotlabs/Module | |
parent | 437aa168d136db2c782ed2b366e411721f5f605c (diff) | |
download | volse-hubzilla-17091bd38c4e4e5d8b1812dd1d9efeffe0046d02.tar.gz volse-hubzilla-17091bd38c4e4e5d8b1812dd1d9efeffe0046d02.tar.bz2 volse-hubzilla-17091bd38c4e4e5d8b1812dd1d9efeffe0046d02.zip |
add get_photo hook to go along with get_profile_photo hook. This allows a plugin to over-ride the permissions for cover photos or insert a different photo in place of that requested
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Photo.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 1134f4275..256a51e71 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -127,17 +127,7 @@ class Photo extends \Zotlabs\Web\Controller { } } - // If using resolution 1, make sure it exists before proceeding: - if($resolution == 1) { - $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", - dbesc($photo), - intval($resolution) - ); - if(! $r) { - $resolution = 2; - } - } - + $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution) @@ -166,6 +156,14 @@ class Photo extends \Zotlabs\Web\Controller { intval($resolution) ); + $d = [ 'imgscale' => $resolution, 'resource_id' => $photo, 'photo' => $r, 'allowed' => $allowed ]; + call_hooks('get_photo',$d); + + $resolution = $d['imgscale']; + $photo = $d['resource_id']; + $r = $d['photo']; + $allowed = $d['allowed']; + if($r && $allowed) { $data = dbunescbin($r[0]['content']); $mimetype = $r[0]['mimetype']; @@ -200,6 +198,9 @@ class Photo extends \Zotlabs\Web\Controller { } } + + + if(! isset($data)) { if(isset($resolution)) { switch($resolution) { |