aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-15 16:49:27 -0800
committerFriendika <info@friendika.com>2010-11-15 16:49:27 -0800
commit9be5a7c750e2634a37529945ced226e0cb06c274 (patch)
treed3d83062572fb82da046c99d5049eefe15fe78c7 /mod
parenteae34f323b85d4126c81eda679d1350d171fd8da (diff)
downloadvolse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.tar.gz
volse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.tar.bz2
volse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.zip
use gravatar for default avatars
Diffstat (limited to 'mod')
-rw-r--r--mod/register.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/mod/register.php b/mod/register.php
index a0a5e5c28..1c068419e 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -187,6 +187,46 @@ function register_post(&$a) {
}
+ require_once('include/Photo.php');
+
+ $photo = gravatar_img($email);
+ $photo_failure = false;
+
+ $filename = basename($photo);
+ $img_str = fetch_url($photo,true);
+ $img = new Photo($img_str);
+ if($img->is_valid()) {
+
+ $img->scaleImageSquare(175);
+
+ $hash = photo_new_resource();
+
+ $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
+
+ if($r === false)
+ $photo_failure = true;
+
+ $img->scaleImage(80);
+
+ $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
+
+ if($r === false)
+ $photo_failure = true;
+
+ $img->scaleImage(48);
+
+ $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
+
+ if($r === false)
+ $photo_failure = true;
+
+ if(! $photo_failure) {
+ q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
+ dbesc($hash)
+ );
+ }
+ }
+
if( $a->config['register_policy'] == REGISTER_OPEN ) {
$email_tpl = load_view_file("view/register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(