Skip to content

Commit

Permalink
make default profile photo configurable - should be functional but ne…
Browse files Browse the repository at this point in the history
…eds admin ui
  • Loading branch information
friendica committed Dec 20, 2013
1 parent f8042cc commit 7c81889
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 120 deletions.
Binary file added images/default_profile_photos/blank/175.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/default_profile_photos/blank/48.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/default_profile_photos/blank/80.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/default_profile_photos/red_koala/175.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/default_profile_photos/red_koala/48.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/default_profile_photos/red_koala/80.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions include/identity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}




2 changes: 1 addition & 1 deletion include/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
6 changes: 3 additions & 3 deletions include/photo/photo_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
12 changes: 6 additions & 6 deletions mod/photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function photo_init(&$a) {

$observer_xchan = get_observer_hash();

$default = 'images/default_profile_photos/rainbow_man/175.jpg';
$default = get_default_profile_photo();

if(isset($type)) {

Expand All @@ -38,11 +38,11 @@ function photo_init(&$a) {

case 'm':
$resolution = 5;
$default = 'images/default_profile_photos/rainbow_man/80.jpg';
$default = get_default_profile_photo(80);
break;
case 's':
$resolution = 6;
$default = 'images/default_profile_photos/rainbow_man/48.jpg';
$default = get_default_profile_photo(48);
break;
case 'l':
default:
Expand Down Expand Up @@ -135,15 +135,15 @@ function photo_init(&$a) {
switch($resolution) {

case 4:
$data = file_get_contents('images/default_profile_photos/rainbow_man/175.jpg');
$data = file_get_contents(get_default_profile_photo());
$mimetype = 'image/jpeg';
break;
case 5:
$data = file_get_contents('images/default_profile_photos/rainbow_man/80.jpg');
$data = file_get_contents(get_default_profile_photo(80));
$mimetype = 'image/jpeg';
break;
case 6:
$data = file_get_contents('images/default_profile_photos/rainbow_man/48.jpg');
$data = file_get_contents(get_default_profile_photo(48));
$mimetype = 'image/jpeg';
break;
default:
Expand Down
50 changes: 0 additions & 50 deletions mod/qsearch.php

This file was deleted.

60 changes: 0 additions & 60 deletions mod/redir.php

This file was deleted.

0 comments on commit 7c81889

Please sign in to comment.