diff options
author | git-marijus <mario@mariovavti.com> | 2017-06-09 12:57:05 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2017-06-09 12:57:05 +0200 |
commit | 8f2457855c89d0bac57694348608d9dad396dd36 (patch) | |
tree | 158c18f72c2ecfba3c71d0132e930a851685024d /Zotlabs/Module | |
parent | 7e4c880e1ee993537de80f923445191bc53f3698 (diff) | |
parent | f730e476f0d6db20eea29cd97e995f91a793d61c (diff) | |
download | volse-hubzilla-8f2457855c89d0bac57694348608d9dad396dd36.tar.gz volse-hubzilla-8f2457855c89d0bac57694348608d9dad396dd36.tar.bz2 volse-hubzilla-8f2457855c89d0bac57694348608d9dad396dd36.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Getfile.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Zotlabs/Module/Getfile.php b/Zotlabs/Module/Getfile.php index 3d859d94b..0b05d78a4 100644 --- a/Zotlabs/Module/Getfile.php +++ b/Zotlabs/Module/Getfile.php @@ -35,6 +35,7 @@ class Getfile extends \Zotlabs\Web\Controller { $sig = $_POST['signature']; $resource = $_POST['resource']; $revision = intval($_POST['revision']); + $resolution = (-1); if(! $hash) killme(); @@ -46,6 +47,11 @@ class Getfile extends \Zotlabs\Web\Controller { killme(); } + if(substr($resource,-2,1) == '-') { + $resolution = intval(substr($resource,-1,1)); + $resource = substr($resource,0,-2); + } + $slop = intval(get_pconfig($channel['channel_id'],'system','getfile_time_slop')); if($slop < 1) $slop = 3; @@ -63,6 +69,35 @@ class Getfile extends \Zotlabs\Web\Controller { killme(); } + + if($resolution > 0) { + $r = q("select * from photo where resource_id = '%s' and uid = %d limit 1", + dbesc($resource), + intval($channel['channel_id']) + ); + if($r) { + header('Content-type: ' . $r[0]['mimetype']); + + if(intval($r[0]['os_storage'])) { + $fname = dbunescbin($r[0]['content']); + if(strpos($fname,'store') !== false) + $istream = fopen($fname,'rb'); + else + $istream = fopen('store/' . $channel['channel_address'] . '/' . $fname,'rb'); + $ostream = fopen('php://output','wb'); + if($istream && $ostream) { + pipe_streams($istream,$ostream); + fclose($istream); + fclose($ostream); + } + } + else { + echo dbunescbin($r[0]['content']); + } + } + killme(); + } + $r = attach_by_hash($resource,$channel['channel_hash'],$revision); if(! $r['success']) { |