aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2016-01-15 20:58:10 +0100
committermrjive <mrjive@mrjive.it>2016-01-15 20:58:10 +0100
commit763c700372ee91f3f840c6fba915cb4d941c34a0 (patch)
tree1d7e4a7f19825b6417764e2c46d3cd109f94b075 /include/identity.php
parent2696deb2a18ba06593657a2317176baa26821708 (diff)
parent2498df68c716ec6ed80b5547c721ca9741a85572 (diff)
downloadvolse-hubzilla-763c700372ee91f3f840c6fba915cb4d941c34a0.tar.gz
volse-hubzilla-763c700372ee91f3f840c6fba915cb4d941c34a0.tar.bz2
volse-hubzilla-763c700372ee91f3f840c6fba915cb4d941c34a0.zip
Merge pull request #17 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/identity.php b/include/identity.php
index 1d908056f..deccaa299 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1737,3 +1737,38 @@ function auto_channel_create($account_id) {
}
+function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_1200) {
+
+ $r = q("select height, width, resource_id, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ intval($channel_id),
+ intval($res),
+ intval(PHOTO_COVER)
+ );
+ if(! $r)
+ return false;
+
+ $output = false;
+
+ $url = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $res ;
+
+ switch($format) {
+ case 'bbcode':
+ $output = '[zrl=' . $r[0]['width'] . 'x' . $r[0]['height'] . ']' . $url . '[/zrl]';
+ break;
+ case 'html':
+ $output = '<img class="zrl" width="' . $r[0]['width'] . '" height="' . $r[0]['height'] . '" src="' . $url . '" alt="' . t('cover photo') . '" />';
+ break;
+ case 'array':
+ default:
+ $output = array(
+ 'width' => $r[0]['width'],
+ 'height' => $r[0]['type'],
+ 'type' => $r[0]['type'],
+ 'url' => $url
+ );
+ break;
+ }
+
+ return $output;
+
+} \ No newline at end of file