One typing thing. And a missed exception case.
Get src from displayUrl() instead of url for example.
if ($size === 'original') {
try {
$avatar = Avatar::getOriginal($profile);
if ($size === 'original') {
try {
$avatar = Avatar::getOriginal($profile);
+ $url = $avatar->displayUrl();
} catch (Exception $e) {
$url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
}
} catch (Exception $e) {
$url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
}
// TRANS: Header on avatar upload page for thumbnail of originally uploaded avatar (h2).
$this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
// TRANS: Header on avatar upload page for thumbnail of originally uploaded avatar (h2).
$this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
- $this->element('img', array('src' => $original->url,
+ $this->element('img', array('src' => $original->displayUrl(),
'width' => $original->width,
'height' => $original->height,
'alt' => $user->nickname));
'width' => $original->width,
'height' => $original->height,
'alt' => $user->nickname));
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
$this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
$this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
- $this->element('img', array('src' => $avatar->url,
+ $this->element('img', array('src' => $avatar->displayUrl(),
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
$this->elementEnd('based_near');
}
$this->elementEnd('based_near');
}
- $avatar = Avatar::getOriginal($this->profile);
- if ($avatar) {
+ try {
+ $avatar = Avatar::getOriginal($this->profile);
$this->elementStart('img');
$this->elementStart('img');
- $this->elementStart('Image', array('rdf:about' => $avatar->url));
+ $this->elementStart('Image', array('rdf:about' => $avatar->displayUrl()));
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
try {
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
try {
- $scaled = Avatar::getOriginal($this->profile);
+ $scaled = $this->profile->getAvatar($size);
$this->elementStart('thumbnail');
$this->elementStart('thumbnail');
- $this->element('Image', array('rdf:about' => $scaled->url));
+ $this->element('Image', array('rdf:about' => $scaled->displayUrl()));
$this->elementEnd('thumbnail');
} catch (Exception $e) {
// This avatar did not exist
$this->elementEnd('thumbnail');
} catch (Exception $e) {
// This avatar did not exist
}
$this->elementEnd('Image');
$this->elementEnd('img');
}
$this->elementEnd('Image');
$this->elementEnd('img');
+ } catch (Exception $e) {
+ // No avatar for this user!
}
$person = $this->showMicrobloggingAccount($this->profile,
}
$person = $this->showMicrobloggingAccount($this->profile,
- $user = $this->user;
- $profile = $user->getProfile();
- try {
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
- return $avatar->url;
- } catch (Exception $e) {
- return null;
- }
+ $profile = $this->user->getProfile();
+ return $profile->avatarUrl(AVATAR_PROFILE_SIZE);
}
// override parent to add X-SUP-ID URL
}
// override parent to add X-SUP-ID URL
- public static function hasOriginal($profile) {
+ public static function hasOriginal(Profile $profile) {
try {
$avatar = Avatar::getOriginal($profile);
} catch (NoResultException $e) {
try {
$avatar = Avatar::getOriginal($profile);
} catch (NoResultException $e) {
- // For backwards compatibility only!
- public function getOriginalAvatar()
- {
- try {
- return Avatar::getOriginal($this);
- } catch (Exception $e) {
- return null;
- }
- }
-
function setOriginal($filename)
{
$imagefile = new ImageFile($this->id, Avatar::path($filename));
function setOriginal($filename)
{
$imagefile = new ImageFile($this->id, Avatar::path($filename));
if ($this->type == ActivityObject::PERSON
|| $this->type == ActivityObject::GROUP) {
if ($this->type == ActivityObject::PERSON
|| $this->type == ActivityObject::GROUP) {
- foreach ($this->avatarLinks as $avatar) {
- $xo->element(
- 'link', array(
- 'rel' => 'avatar',
- 'type' => $avatar->type,
- 'media:width' => $avatar->width,
- 'media:height' => $avatar->height,
- 'href' => $avatar->url
- ),
- null
- );
+ foreach ($this->avatarLinks as $alink) {
+ $xo->element('link',
+ array(
+ 'rel' => 'avatar',
+ 'type' => $alink->type,
+ 'media:width' => $alink->width,
+ 'media:height' => $alink->height,
+ 'href' => $alink->url,
+ ),
+ null);