New avatar picture fields to better cope with changing avatars

This commit is contained in:
Michael Vogel 2016-01-28 01:26:19 +01:00
commit 6f662b8c74
15 changed files with 143 additions and 59 deletions

View file

@ -295,7 +295,9 @@ function _contact_update_profile($contact_id) {
$photos = import_profile_photo($data['photo'], local_user(), $contact_id);
$r = q("UPDATE `contact` SET `photo` = '%s',
$r = q("UPDATE `contact` SET
`avatar` = '%s',
`photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
@ -303,6 +305,7 @@ function _contact_update_profile($contact_id) {
`avatar-date` = '%s'
WHERE `id` = %d",
dbesc($data["photo"]),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),

View file

@ -82,7 +82,9 @@ function crepair_post(&$a) {
$photos = import_profile_photo($photo,local_user(),$contact['id']);
$x = q("UPDATE `contact` SET `photo` = '%s',
$x = q("UPDATE `contact` SET
`avatar` = '%s',
`photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
@ -90,6 +92,7 @@ function crepair_post(&$a) {
`avatar-date` = '%s'
WHERE `id` = %d
",
dbesc($photo),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),

View file

@ -329,6 +329,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$duplex = 0;
$r = q("UPDATE `contact` SET
`avatar` = '%s',
`photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
@ -342,6 +343,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`hidden` = %d,
`network` = '%s' WHERE `id` = %d
",
dbesc($contact['photo']),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
@ -695,6 +697,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$duplex = 0;
$r = q("UPDATE `contact` SET
`avatar` = '%s',
`photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
@ -709,6 +712,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`prv` = %d,
`network` = '%s' WHERE `id` = %d
",
dbesc($photo),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),

View file

@ -1146,6 +1146,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
if (!$r) {
$probed = probe_url($name);
if (isset($probed["url"])) {
$probed["avatar"] = $probed["photo"];
update_gcontact($probed);
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($probed["url"])));

View file

@ -179,6 +179,9 @@ function poco_init(&$a) {
$rr['generation'] = 2;
}
if ($rr["avatar"] == "")
$rr["avatar"] = $rr["photo"];
if (($rr['about'] == "") AND isset($rr['pabout']))
$rr['about'] = $rr['pabout'];
@ -258,7 +261,7 @@ function poco_init(&$a) {
$entry['updated'] = date("c", strtotime($entry['updated']));
}
if($fields_ret['photos'])
$entry['photos'] = array(array('value' => $rr['photo'], 'type' => 'profile'));
$entry['photos'] = array(array('value' => $rr['avatar'], 'type' => 'profile'));
if($fields_ret['network']) {
$entry['network'] = $rr['network'];
if ($entry['network'] == NETWORK_STATUSNET)

View file

@ -158,6 +158,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
killme();
}
logger("Check size of picture.", LOGGER_DEBUG);
$r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
intval($page_owner_uid)
);
@ -176,6 +177,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
}
logger("Picture will be processed.", LOGGER_DEBUG);
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata, $filetype);
@ -210,6 +212,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
$defperm = '<' . $default_cid . '>';
logger("Picture will be stored", LOGGER_DEBUG);
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 0, 0, $defperm);
if(! $r) {
@ -266,6 +269,8 @@ function wall_upload_post(&$a, $desktopmode = true) {
return $picture;
}
logger("Picture is stored.", LOGGER_DEBUG);
if ($r_json) {
echo json_encode(array('ok'=>true));
killme();