Properly unlink all old avatars when deleting/uploading a new

We're also now using $config['image']['jpegquality'] to determine the
quality setting for resized images.

To set Avatar max size, adjust $config['avatar']['maxsize']

The getAvatar call now throws exceptions too. Related changes applied.
Now let's move Profile->avatarUrl to the Avatar class!
This commit is contained in:
Mikael Nordfeldth
2013-10-01 11:37:59 +02:00
parent a7e748479c
commit b0dfc70a54
47 changed files with 219 additions and 335 deletions

View File

@@ -214,9 +214,7 @@ class ApiAction extends Action
$twitter_user['location'] = ($profile->location) ? $profile->location : null;
$twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() :
Avatar::defaultImage(AVATAR_STREAM_SIZE);
$twitter_user['profile_image_url'] = $profile->avatarUrl(AVATAR_STREAM_SIZE);
$twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
$twitter_user['protected'] = (!empty($user) && $user->private_stream) ? true : false;
@@ -995,10 +993,13 @@ class ApiAction extends Action
$entry['author-name'] = $from->getBestName();
$entry['author-uri'] = $from->homepage;
$avatar = $from->getAvatar(AVATAR_STREAM_SIZE);
$entry['avatar'] = (!empty($avatar)) ? $avatar->url : Avatar::defaultImage(AVATAR_STREAM_SIZE);
$entry['avatar-type'] = (!empty($avatar)) ? $avatar->mediatype : 'image/png';
$entry['avatar'] = $from->avatarUrl(AVATAR_STREAM_SIZE);
try {
$avatar = $from->getAvatar(AVATAR_STREAM_SIZE);
$entry['avatar-type'] = $avatar->mediatype;
} catch (Exception $e) {
$entry['avatar-type'] = 'image/png';
}
// RSS item specific