allow custom avatar sizes - needed for Diaspora hcard/vcard
This commit is contained in:
parent
ad1e827169
commit
d45a66e700
4 changed files with 43 additions and 3 deletions
18
boot.php
18
boot.php
|
@ -877,7 +877,9 @@ function profile_sidebar($profile) {
|
||||||
$podloc = $a->get_baseurl();
|
$podloc = $a->get_baseurl();
|
||||||
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
|
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
|
||||||
$nickname = $profile['nick'];
|
$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
|
$diaspora_vcard = <<< EOT
|
||||||
|
|
||||||
|
@ -897,7 +899,19 @@ function profile_sidebar($profile) {
|
||||||
<dl class="entity_photo">
|
<dl class="entity_photo">
|
||||||
<dt>Photo</dt>
|
<dt>Photo</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<img class="photo avatar" height="175px" src="$dphoto" width='175px'>
|
<img class="photo avatar" height="300px" width="300px" src="$photo300">
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_photo_medium">
|
||||||
|
<dt>Photo</dt>
|
||||||
|
<dd>
|
||||||
|
<img class="photo avatar" height="100px" width="100px" src="$photo100">
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_photo_small">
|
||||||
|
<dt>Photo</dt>
|
||||||
|
<dd>
|
||||||
|
<img class="photo avatar" height="50px" width="50px" src="$photo50">
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class='entity_searchable'>
|
<dl class='entity_searchable'>
|
||||||
|
|
|
@ -995,6 +995,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
|
||||||
|
|
||||||
require_once('library/simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
|
|
||||||
|
if(! strlen($xml)) {
|
||||||
|
logger('consume_feed: empty input');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
$feed->set_raw_data($xml);
|
$feed->set_raw_data($xml);
|
||||||
if($datedir)
|
if($datedir)
|
||||||
|
|
|
@ -732,6 +732,9 @@ function link_compare($a,$b) {
|
||||||
return false;
|
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')) {
|
if(! function_exists('prepare_body')) {
|
||||||
function prepare_body($item,$attach = false) {
|
function prepare_body($item,$attach = false) {
|
||||||
|
@ -771,6 +774,9 @@ function prepare_body($item,$attach = false) {
|
||||||
return $s;
|
return $s;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
// Given a text string, convert from bbcode to html and add smilie icons.
|
||||||
|
|
||||||
if(! function_exists('prepare_text')) {
|
if(! function_exists('prepare_text')) {
|
||||||
function prepare_text($text) {
|
function prepare_text($text) {
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,11 @@ require_once('include/security.php');
|
||||||
function photo_init(&$a) {
|
function photo_init(&$a) {
|
||||||
|
|
||||||
switch($a->argc) {
|
switch($a->argc) {
|
||||||
|
case 4:
|
||||||
|
$person = $a->argv[3];
|
||||||
|
$customres = intval($a->argv[2]);
|
||||||
|
$type = $a->argv[1];
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$person = $a->argv[2];
|
$person = $a->argv[2];
|
||||||
$type = $a->argv[1];
|
$type = $a->argv[1];
|
||||||
|
@ -29,6 +34,7 @@ function photo_init(&$a) {
|
||||||
switch($type) {
|
switch($type) {
|
||||||
|
|
||||||
case 'profile':
|
case 'profile':
|
||||||
|
case 'custom':
|
||||||
$resolution = 4;
|
$resolution = 4;
|
||||||
break;
|
break;
|
||||||
case 'micro':
|
case 'micro':
|
||||||
|
@ -113,6 +119,15 @@ function photo_init(&$a) {
|
||||||
// NOTREACHED
|
// 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");
|
header("Content-type: image/jpeg");
|
||||||
echo $data;
|
echo $data;
|
||||||
killme();
|
killme();
|
||||||
|
|
Loading…
Reference in a new issue