diff options
author | friendica <info@friendica.com> | 2013-02-02 01:58:11 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-02-02 01:58:11 -0800 |
commit | 7645b440e893959846da2e8984c2a0a7e8c62a3b (patch) | |
tree | ed26b038fff446e24b417ccdc259f7e86088dfa6 /include | |
parent | 344b8593a818c9ea1d07a365b8a2496d699b1620 (diff) | |
download | volse-hubzilla-7645b440e893959846da2e8984c2a0a7e8c62a3b.tar.gz volse-hubzilla-7645b440e893959846da2e8984c2a0a7e8c62a3b.tar.bz2 volse-hubzilla-7645b440e893959846da2e8984c2a0a7e8c62a3b.zip |
more progress on photos api
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 11 | ||||
-rw-r--r-- | include/photos.php | 38 |
2 files changed, 48 insertions, 1 deletions
diff --git a/include/attach.php b/include/attach.php index b2c57f36f..e4ef28637 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1,5 +1,14 @@ <?php +/* + * File/attach API with the potential for revision control. + * + * TODO: a filesystem storage abstraction which maintains security (and 'data' contains a system filename + * which is inaccessible from the web). This could get around PHP storage limits and store videos and larger + * items, using fread or OS methods or native code to read/write or chunk it through. + * Also an 'append' option to the storage function might be a useful addition. + */ + require_once('include/permissions.php'); function z_mime_content_type($filename) { @@ -151,6 +160,8 @@ function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $ } +// Find an attachment by hash and revision. Returns the entire attach structure including data. +// This could exhaust memory so most useful only when immediately sending the data. function attach_by_hash($hash,$rev = 0) { diff --git a/include/photos.php b/include/photos.php index 0d0750c22..8e07c612f 100644 --- a/include/photos.php +++ b/include/photos.php @@ -181,7 +181,6 @@ function photo_upload($channel, $observer, $args) { $basename = basename($filename); $uri = item_message_id(); - // Create item container $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; @@ -319,3 +318,40 @@ function photos_album_get_db_idstr($channel_id,$album,$remote_xchan = '') { return false; } + +function photos_create_item($channel, $creator_hash, $photo, $visible = false) { + + // Create item container + + $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $item_restrict = (($visible) ? ITEM_HIDDEN : ITEM_VISIBLE); + + $title = ''; + $uri = item_message_id(); + + $arr = array(); + + $arr['aid'] = $channel['channel_account_id']; + $arr['uid'] = $channel['channel_id']; + $arr['uri'] = $uri; + $arr['parent_uri'] = $uri; + $arr['item_flags'] = $item_flags; + $arr['item_restrict'] = $item_restrict; + $arr['resource_type'] = 'photo'; + $arr['resource_id'] = $photo['resource_id']; + $arr['owner_xchan'] = $channel['channel_hash']; + $arr['author_xchan'] = $creator_hash; + + $arr['allow_cid'] = $photo['allow_cid']; + $arr['allow_gid'] = $photo['allow_gid']; + $arr['deny_cid'] = $photo['deny_cid']; + $arr['deny_gid'] = $photo['deny_gid']; + + $arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' + . '[img]' . $a->get_baseurl() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/img]' + . '[/url]'; + + $item_id = item_store($arr); + return $item_id; + +}
\ No newline at end of file |