aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-04 23:50:32 -0700
committerFriendika <info@friendika.com>2010-11-04 23:50:32 -0700
commitb94cb8d234d70bc534ad1cef767b9f62d10eef26 (patch)
tree9e8cf0d529421c7b8d8e389478be8c4b196d11e6 /mod
parent71ae08d506130e45f68cf4e09d71f3a1c2e2d782 (diff)
downloadvolse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.tar.gz
volse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.tar.bz2
volse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.zip
add micro profile photo
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_confirm.php8
-rw-r--r--mod/follow.php4
-rw-r--r--mod/photo.php11
-rw-r--r--mod/photos.php5
-rw-r--r--mod/profile_photo.php7
-rw-r--r--mod/register.php5
6 files changed, 30 insertions, 10 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 705f74f13..4a5fe1114 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -238,7 +238,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$new_relation = REL_BUD;
$r = q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
`rel` = %d,
`name-date` = '%s',
`uri-date` = '%s',
@@ -250,6 +251,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
",
dbesc($photos[0]),
dbesc($photos[1]),
+ dbesc($photos[2]),
intval($new_relation),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
@@ -281,7 +283,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
);
$r = q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s',
@@ -293,6 +296,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
",
dbesc($photos[0]),
dbesc($photos[1]),
+ dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
diff --git a/mod/follow.php b/mod/follow.php
index 235353f7a..d839a04d4 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -122,7 +122,8 @@ function follow_post(&$a) {
$photos = import_profile_photo($vcard['photo'],local_user(),$contact_id);
$r = q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s'
@@ -130,6 +131,7 @@ function follow_post(&$a) {
",
dbesc($photos[0]),
dbesc($photos[1]),
+ dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
diff --git a/mod/photo.php b/mod/photo.php
index 4e0b85b45..d4abb041a 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -16,15 +16,22 @@ function photo_init(&$a) {
return; // NOTREACHED
}
+ $default = 'images/default-profile.jpg';
+
if(isset($type)) {
switch($type) {
case 'profile':
$resolution = 4;
break;
+ case 'micro':
+ $resolution = 6;
+ $default = 'images/default-profile-mm.jpg';
+ break;
case 'avatar':
default:
$resolution = 5;
+ $default = 'images/default-profile-sm.jpg';
break;
}
@@ -38,9 +45,7 @@ function photo_init(&$a) {
$data = $r[0]['data'];
}
if(! isset($data)) {
- $data = file_get_contents(($resolution == 5)
- ? 'images/default-profile-sm.jpg'
- : 'images/default-profile.jpg');
+ $data = file_get_contents($default);
}
}
else {
diff --git a/mod/photos.php b/mod/photos.php
index a3aa69216..f3eccd127 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -312,9 +312,9 @@ function photos_post(&$a) {
}
if($profile) {
if(substr($notify,0,4) === 'cid:')
- $taginfo[] = array($newname,$profile,$notify,$r[0]);
+ $taginfo[] = array($newname,$profile,$notify,$r[0],'@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]');
else
- $taginfo[] = array($newname,$profile,$notify,null);
+ $taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]');
if(strlen($str_tags))
$str_tags .= ',';
$profile = str_replace(',','%2c',$profile);
@@ -384,6 +384,7 @@ function photos_post(&$a) {
$arr['verb'] = ACTIVITY_TAG;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['target-type'] = ACTIVITY_OBJ_PHOTO;
+ $arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2];
$arr['body'] = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $contact_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $contact_record['url'] . ']' . $contact_record['name'] . '[/url]' ;
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index b21d9162a..32ace62f0 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -68,6 +68,13 @@ function profile_photo_post(&$a) {
if($r === false)
notice( t('Image size reduction [80] failed.') . EOL );
+ $im->scaleImage(48);
+
+ $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, 1);
+
+ if($r === false)
+ notice( t('Image size reduction [48] failed.') . EOL );
+
// Unset the profile photo flag from any other photos I own
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
diff --git a/mod/register.php b/mod/register.php
index 52c3863eb..5c62c1294 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -161,15 +161,16 @@ function register_post(&$a) {
intval($newuid));
return;
}
- $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `blocked`, `pending`, `url`,
+ $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`,
`request`, `notify`, `poll`, `confirm`, `name-date`, `uri-date`, `avatar-date` )
- VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+ VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($newuid),
datetime_convert(),
dbesc($username),
dbesc($nickname),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
+ dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/profile/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"),