From d45a66e700a62626007b05ef1b78dff8f0931210 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 3 Aug 2011 21:05:39 -0700 Subject: allow custom avatar sizes - needed for Diaspora hcard/vcard --- boot.php | 18 ++++++++++++++++-- include/items.php | 5 +++++ include/text.php | 6 ++++++ mod/photo.php | 17 ++++++++++++++++- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index b306b1402..9ff17b466 100644 --- a/boot.php +++ b/boot.php @@ -877,7 +877,9 @@ function profile_sidebar($profile) { $podloc = $a->get_baseurl(); $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ); $nickname = $profile['nick']; - $dphoto = $profile['photo']; + $photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'; + $photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'; + $photo50 = $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'; $diaspora_vcard = <<< EOT @@ -897,7 +899,19 @@ function profile_sidebar($profile) {
Photo
- + +
+
+
+
Photo
+
+ +
+
+
+
Photo
+
+
diff --git a/include/items.php b/include/items.php index 8c6134f94..047dd4442 100644 --- a/include/items.php +++ b/include/items.php @@ -995,6 +995,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee require_once('library/simplepie/simplepie.inc'); + if(! strlen($xml)) { + logger('consume_feed: empty input'); + return; + } + $feed = new SimplePie(); $feed->set_raw_data($xml); if($datedir) diff --git a/include/text.php b/include/text.php index a568b7a94..d53a2ceb9 100644 --- a/include/text.php +++ b/include/text.php @@ -732,6 +732,9 @@ function link_compare($a,$b) { return false; }} +// Given an item array, convert the body element from bbcode to html and add smilie icons. +// If attach is true, also add icons for item attachments + if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { @@ -771,6 +774,9 @@ function prepare_body($item,$attach = false) { return $s; }} + +// Given a text string, convert from bbcode to html and add smilie icons. + if(! function_exists('prepare_text')) { function prepare_text($text) { diff --git a/mod/photo.php b/mod/photo.php index 9809aa418..3994620f8 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -5,6 +5,11 @@ require_once('include/security.php'); function photo_init(&$a) { switch($a->argc) { + case 4: + $person = $a->argv[3]; + $customres = intval($a->argv[2]); + $type = $a->argv[1]; + break; case 3: $person = $a->argv[2]; $type = $a->argv[1]; @@ -29,6 +34,7 @@ function photo_init(&$a) { switch($type) { case 'profile': + case 'custom': $resolution = 4; break; case 'micro': @@ -113,8 +119,17 @@ function photo_init(&$a) { // NOTREACHED } + if(intval($customres) && $customres > 0 && $customres < 500) { + require_once('include/Photo.php'); + $ph = new Photo($data); + if($ph->is_valid()) { + $ph->scaleImageSquare($customres); + $data = $ph->imageString(); + } + } + header("Content-type: image/jpeg"); echo $data; killme(); // NOTREACHED -} \ No newline at end of file +} -- cgit v1.2.3