From 7c81889b3397f09dfba4f17bba99f6d1dad9d0b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 16:33:36 -0800 Subject: make default profile photo configurable - should be functional but needs admin ui --- include/identity.php | 21 +++++++++++++++++++++ include/network.php | 2 +- include/photo/photo_driver.php | 6 +++--- 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 6bbf193c1..4d38b2828 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1109,3 +1109,24 @@ function get_theme_uid() { } return $uid; } + +/** + * @function get_default_profile_photo($size = 175) + * Retrieves the path of the default_profile_photo for this system + * with the specified size. + * @param int $size + * one of (175, 80, 48) + * @returns string + * + */ + +function get_default_profile_photo($size = 175) { + $scheme = get_config('system','default_profile_photo'); + if(! $scheme) + $scheme = 'rainbow_man'; + return 'images/default_profile_photos/' . $scheme . '/' . $size . 'jpg'; +} + + + + \ No newline at end of file diff --git a/include/network.php b/include/network.php index 7446c2384..3fe7f5400 100644 --- a/include/network.php +++ b/include/network.php @@ -548,7 +548,7 @@ function avatar_img($email) { call_hooks('avatar_lookup', $avatar); if(! $avatar['success']) - $avatar['url'] = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/175.jpg'; + $avatar['url'] = $a->get_baseurl() . '/' . get_default_profile_photo(); logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG); return $avatar['url']; diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 8730b4298..3d8ee2196 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -576,9 +576,9 @@ function import_profile_photo($photo,$xchan) { $photo_failure = true; } if($photo_failure) { - $photo = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/175.jpg'; - $thumb = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/80.jpg'; - $micro = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/48.jpg'; + $photo = $a->get_baseurl() . '/' . get_default_profile_photo(); + $thumb = $a->get_baseurl() . '/' . get_default_profile_photo(80); + $micro = $a->get_baseurl() . '/' . get_default_profile_photo(48); $type = 'image/jpeg'; } -- cgit v1.2.3