aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-02-01 21:09:50 -0800
committerredmatrix <git@macgirvin.com>2016-02-01 21:09:50 -0800
commit5edbc008659141349857363974f3760c41e7a5e5 (patch)
treeae584fc6becc3bd22ef78314c5fc09cd05110082 /include/identity.php
parent723a49cceecf92a87eb34243e824b8deb900f184 (diff)
downloadvolse-hubzilla-5edbc008659141349857363974f3760c41e7a5e5.tar.gz
volse-hubzilla-5edbc008659141349857363974f3760c41e7a5e5.tar.bz2
volse-hubzilla-5edbc008659141349857363974f3760c41e7a5e5.zip
profile embeds (still needs a bit of work)
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/identity.php b/include/identity.php
index 11b80a46d..037cf5061 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1781,3 +1781,45 @@ function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_
return $output;
}
+
+function get_zcard($channel,$observer_hash = '',$args = array()) {
+
+ logger('get_zcard');
+
+ $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname();
+
+ $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ intval($channel['channel_id']),
+ intval(PHOTO_RES_COVER_1200),
+ intval(PHOTO_COVER)
+ );
+
+ if($r) {
+ $cover = $r[0];
+ $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale'];
+ }
+
+ $pphoto = array('type' => $channel['xchan_photo_mimetype'],
+ 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
+
+ $maxwidth = (($args['width']) ? intval($args['width']) : 0);
+ $maxheight = (($args['height']) ? intval($args['height']) : 0);
+
+ $zcard = array('chan' => $channel);
+ if(($maxwidth > 1200) || ($maxwidth < 1))
+ $maxwidth = 1200;
+ $scale = (float) $maxwidth / 1200;
+
+ $translate = intval(($scale / 1.0) * 100);
+
+ $o .= replace_macros(get_markup_template('zcard.tpl'),array(
+ '$scale' => $scale,
+ '$translate' => $translate,
+ '$cover' => $cover,
+ '$pphoto' => $pphoto,
+ '$zcard' => $zcard
+ ));
+
+ return $o;
+
+} \ No newline at end of file