add photo_detail api call

This commit is contained in:
redmatrix 2015-08-18 22:14:16 -07:00
parent 72b7b19937
commit c96f121d41

View File

@ -631,6 +631,27 @@ require_once('include/items.php');
}
api_register_func('api/red/photos','api_photos', true);
function api_photo_detail(&$a,$type) {
if (api_user()===false) return false;
if(! $_REQUEST['photo_id']) return false;
$scale = ((array_key_exists('scale',$_REQUEST)) ? intval($_REQUEST['scale']) : 0);
$r = q("select * from photo where uid = %d and resource_id = '%s' and scale = %d limit 1",
intval(local_channel()),
dbesc($_REQUEST['photo_id']),
intval($scale)
);
if($r) {
$data = dbunescbin($r[0]['data']);
if(array_key_exists('os_storage',$r[0]) && intval($r[0]['os_storage']))
$data = file_get_contents($data);
$r[0]['data'] = base64_encode($data);
json_return_and_die($r[0]);
}
killme();
}
api_register_func('api/red/photo', 'api_photo_detail', true);
function api_group_members(&$a,$type) {
if(api_user() === false)