]> git.mxchange.org Git - friendica.git/commitdiff
New avatar picture fields to better cope with changing avatars
authorMichael Vogel <icarus@dabo.de>
Thu, 28 Jan 2016 00:26:19 +0000 (01:26 +0100)
committerMichael Vogel <icarus@dabo.de>
Thu, 28 Jan 2016 00:26:19 +0000 (01:26 +0100)
15 files changed:
include/Contact.php
include/Photo.php
include/dbstructure.php
include/diaspora.php
include/discover_poco.php
include/follow.php
include/gprobe.php
include/ostatus.php
include/socgraph.php
mod/contacts.php
mod/crepair.php
mod/dfrn_confirm.php
mod/item.php
mod/poco.php
mod/wall_upload.php

index 86e67bbe86a3d16894b78e6f823e423df896cea5..1c99dd02988c114a412ba957345df94437f490c1 100644 (file)
@@ -488,9 +488,10 @@ function get_contact($url, $uid = 0) {
 
        $photos = import_profile_photo($data["photo"],$uid,$contactid);
 
-       q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s',
+       q("UPDATE `contact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s',
                `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
                `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s' WHERE `id` = %d",
+               dbesc($data["photo"]),
                dbesc($photos[0]),
                dbesc($photos[1]),
                dbesc($photos[2]),
index 5fdd682e74e4925d40f7514b07c9f75c91a15d47..e0cb23008ab31abb4bc50d383133a66a1faaa34c 100644 (file)
@@ -720,65 +720,91 @@ function guess_image_type($filename, $fromcurl=false) {
 
 }
 
-function import_profile_photo($photo,$uid,$cid) {
+function update_contact_avatar($avatar,$uid,$cid) {
 
-    $a = get_app();
+       $r = q("SELECT `avatar`, `photo`, `thumb`, `micro` FROM `contact` WHERE `id` = %d LIMIT 1", intval($cid));
+       if (!$r)
+               return false;
+       else
+               $data = array($r[0]["photo"], $r[0]["thumb"], $r[0]["micro"]);
 
-    $r = q("select `resource-id` from photo where `uid` = %d and `contact-id` = %d and `scale` = 4 and `album` = 'Contact Photos' limit 1",
-       intval($uid),
-       intval($cid)
-    );
-    if(count($r) && strlen($r[0]['resource-id'])) {
-       $hash = $r[0]['resource-id'];
-    }
-    else {
-       $hash = photo_new_resource();
-    }
+       if ($r[0]["avatar"] != $avatar) {
+               $photos = import_profile_photo($avatar,$uid,$cid, true);
+
+               if ($photos) {
+                       q("UPDATE `contact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d",
+                               dbesc($avatar), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]),
+                               dbesc(datetime_convert()), intval($cid));
+                       return $photos;
+               }
+       }
+
+       return $data;
+}
+
+function import_profile_photo($photo,$uid,$cid, $quit_on_error = false) {
+
+       $a = get_app();
 
-    $photo_failure = false;
+       $r = q("select `resource-id` from photo where `uid` = %d and `contact-id` = %d and `scale` = 4 and `album` = 'Contact Photos' limit 1",
+               intval($uid),
+               intval($cid)
+       );
+       if(count($r) && strlen($r[0]['resource-id'])) {
+               $hash = $r[0]['resource-id'];
+       } else {
+               $hash = photo_new_resource();
+       }
 
-    $filename = basename($photo);
-    $img_str = fetch_url($photo,true);
+       $photo_failure = false;
 
-    $type = guess_image_type($photo,true);
-    $img = new Photo($img_str, $type);
-    if($img->is_valid()) {
+       $filename = basename($photo);
+       $img_str = fetch_url($photo,true);
 
-       $img->scaleImageSquare(175);
+       if ($quit_on_error AND ($img_str == ""))
+               return false;
 
-       $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
+       $type = guess_image_type($photo,true);
+       $img = new Photo($img_str, $type);
+       if($img->is_valid()) {
 
-       if($r === false)
-           $photo_failure = true;
+               $img->scaleImageSquare(175);
 
-       $img->scaleImage(80);
+               $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
 
-       $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 );
+               if($r === false)
+                       $photo_failure = true;
 
-       if($r === false)
-           $photo_failure = true;
+               $img->scaleImage(80);
 
-       $img->scaleImage(48);
+               $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 );
 
-       $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 );
+               if($r === false)
+                       $photo_failure = true;
 
-       if($r === false)
-           $photo_failure = true;
+               $img->scaleImage(48);
 
-       $photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
-       $thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
-       $micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
-    }
-    else
-       $photo_failure = true;
+               $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 );
 
-    if($photo_failure) {
-       $photo = $a->get_baseurl() . '/images/person-175.jpg';
-       $thumb = $a->get_baseurl() . '/images/person-80.jpg';
-       $micro = $a->get_baseurl() . '/images/person-48.jpg';
-    }
+               if($r === false)
+                       $photo_failure = true;
+
+               $photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
+               $thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
+               $micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
+       } else
+               $photo_failure = true;
+
+       if($photo_failure AND $quit_on_error)
+               return false;
+
+       if($photo_failure) {
+               $photo = $a->get_baseurl() . '/images/person-175.jpg';
+               $thumb = $a->get_baseurl() . '/images/person-80.jpg';
+               $micro = $a->get_baseurl() . '/images/person-48.jpg';
+       }
 
-    return(array($photo,$thumb,$micro));
+       return(array($photo,$thumb,$micro));
 
 }
 
index 43dfbd7b353185d9ad5f87ab19a82fbb7b061316..fd5883911a6df6e8b17e7c903dd857c89e16a299 100644 (file)
@@ -453,6 +453,7 @@ function db_definition() {
                                        "keywords" => array("type" => "text", "not null" => "1"),
                                        "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
                                        "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "photo" => array("type" => "text", "not null" => "1"),
                                        "thumb" => array("type" => "text", "not null" => "1"),
                                        "micro" => array("type" => "text", "not null" => "1"),
@@ -656,7 +657,10 @@ function db_definition() {
                                        "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "micro" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
index b72239c4ceab1255dc7f297f831231747f6884c7..3f0b4be432b664210cee64735f2eb23f32e145a3 100644 (file)
@@ -740,6 +740,7 @@ function diaspora_request($importer,$xml) {
                        $new_relation = CONTACT_IS_FOLLOWER;
 
                $r = q("UPDATE `contact` SET
+                       `avatar` = '%s',
                        `photo` = '%s',
                        `thumb` = '%s',
                        `micro` = '%s',
@@ -752,6 +753,7 @@ function diaspora_request($importer,$xml) {
                        `writable` = 1
                        WHERE `id` = %d
                        ",
+                       dbesc($contact_record['photo']),
                        dbesc($photos[0]),
                        dbesc($photos[1]),
                        dbesc($photos[2]),
@@ -2491,12 +2493,15 @@ function diaspora_profile($importer,$xml,$msg) {
        /// @TODO Update name on item['author-name'] if the name changed. See consume_feed()
        /// (Not doing this currently because D* protocol is scheduled for revision soon).
 
-       $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
+       $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s',
+                       `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s',
+                       `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
                dbesc($name),
                dbesc($nick),
                dbesc($diaspora_handle),
                dbesc(datetime_convert()),
                dbesc($image_url),
+               dbesc($images[0]),
                dbesc($images[1]),
                dbesc($images[2]),
                dbesc(datetime_convert()),
@@ -2516,7 +2521,7 @@ function diaspora_profile($importer,$xml,$msg) {
        }
 
        update_gcontact(array("url" => $contact['url'], "network" => NETWORK_DIASPORA, "generation" => 2,
-                               "photo" => $image_url, "name" => $name, "location" => $location,
+                               "avatar" => $image_url, "name" => $name, "location" => $location,
                                "about" => $about, "birthday" => $birthday, "gender" => $gender,
                                "addr" => $diaspora_handle, "nick" => $nick, "keywords" => $keywords,
                                "hide" => !$searchable, "nsfw" => $nsfw));
index a8f670334b5d66a00d8fc5022d584472dfa85b80..63d1175a71df137edaa4e5392cd1b0e2c1edcd6d 100644 (file)
@@ -222,6 +222,7 @@ function gs_search_user($search) {
                $contact = probe_url($user->site_address."/".$user->name);
                if ($contact["network"] != NETWORK_PHANTOM) {
                        $contact["about"] = $user->description;
+                       $contact["avatar"] = $contact["photo"];
                        update_gcontact($contact);
                }
        }
index 21c05c8f3ef139062963dfbd05446b96f492d9a4..8e6094cb4d5644d25040702c10e8fadaf0162a8a 100644 (file)
@@ -266,13 +266,16 @@ function new_contact($uid,$url,$interactive = false) {
 
        $photos = import_profile_photo($ret['photo'],$uid,$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',
                        `uri-date` = '%s',
                        `avatar-date` = '%s'
                        WHERE `id` = %d",
+                       dbesc($ret['photo']),
                        dbesc($photos[0]),
                        dbesc($photos[1]),
                        dbesc($photos[2]),
index dfa9137d7de03d6677a20b29a7cdf699c51bb121..8e4d3715c016dc611833cc24a881f36c8d49202e 100644 (file)
@@ -58,8 +58,10 @@ function gprobe_run(&$argv, &$argc){
                if (is_null($result))
                        Cache::set("gprobe:".$urlparts["host"],serialize($arr));
 
-               if (!in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))
+               if (!in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
+                       $arr["avatar"] = $arr["photo"];
                        update_gcontact($arr);
+               }
 
                $r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
                        dbesc(normalise_link($url))
index 4ccd13130d1a8bc01f9780190047899b7dd3e022..eeacd40de4db835a2f4ad1f08668bef539a4f6c7 100644 (file)
@@ -166,13 +166,13 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
                                                "", "", "", datetime_convert(), 2, $contact["id"], $contact["uid"]);
                }
 
-               if (isset($author["author-avatar"]) AND ($author["author-avatar"] != $r[0]['photo'])) {
+               if (isset($author["author-avatar"]) AND ($author["author-avatar"] != $r[0]['avatar'])) {
                        logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
 
                        $photos = import_profile_photo($author["author-avatar"], $importer["uid"], $contact["id"]);
 
-                       q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d AND `network` = '%s'",
-                               dbesc($author["author-avatar"]), dbesc($photos[1]), dbesc($photos[2]),
+                       q("UPDATE `contact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d AND `network` = '%s'",
+                               dbesc($author["author-avatar"]), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]),
                                dbesc(datetime_convert()), intval($contact["id"]), dbesc(NETWORK_OSTATUS));
                }
 
@@ -180,7 +180,7 @@ function ostatus_fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch)
                if ($contact["network"] == NETWORK_OSTATUS) {
                        /// @todo Add the "addr" field
                        $contact["generation"] = 2;
-                       $contact["photo"] = $author["author-avatar"];
+                       $contact["avatar"] = $author["author-avatar"];
                        update_gcontact($contact);
                }
        }
index c545343393d869265e50a016bc5390c764afd320..241e2df7f0825f007aa35b3f0bd1f2f093d02b2d 100644 (file)
@@ -10,7 +10,7 @@
 require_once('include/datetime.php');
 require_once("include/Scrape.php");
 require_once("include/html2bbcode.php");
-
+require_once("include/Contact.php");
 
 /*
  * poco_load
@@ -294,7 +294,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
                        "alias" => $alias,
                        "name" => $name,
                        "network" => $network,
-                       "photo" => $profile_photo,
+                       "avatar" => $profile_photo,
                        "about" => $about,
                        "location" => $location,
                        "gender" => $gender,
@@ -1517,7 +1517,7 @@ function update_gcontact($contact) {
        if (!$gcontact_id)
                return false;
 
-       $r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`,
+       $r = q("SELECT `name`, `nick`, `avatar`, `photo`, `thumb`, `micro`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`,
                        `hide`, `nsfw`, `network`, `alias`, `notify`, `server_url`, `connect`, `updated`, `url`
                FROM `gcontact` WHERE `id` = %d LIMIT 1",
                intval($gcontact_id));
@@ -1552,14 +1552,37 @@ function update_gcontact($contact) {
        if ($contact["generation"] < $r[0]["generation"])
                $update = true;
 
+        if (isset($contact["avatar"]) AND (($contact["avatar"] != $r[0]["avatar"]) OR
+               ($r[0]["photo"] == $r[0]["avatar"]) OR ($r[0]["thumb"] == "") OR ($r[0]["micro"] == ""))) {
+
+               $cid = get_contact($contact["url"]);
+
+               // We always store avatar picture with a contact-id.
+               // We don't have a contact-id when we use the gcontact table.
+               // Solution is to use a matching entry in the contact table. (Which is not totally clean)
+               if (($cid == 0) AND isset($contact["uid"]))
+                       $cid = get_contact($contact["url"], $contact["uid"]);
+
+               $photos = update_contact_avatar($contact["avatar"], 0, $cid);
+
+               if ($photos) {
+                       $contact["photo"] = $photos[0];
+                       $contact["thumb"] = $photos[1];
+                       $contact["micro"] = $photos[2];
+               }
+       }
+
        if ($update) {
-               q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s', `network` = '%s',
+
+               q("UPDATE `gcontact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s',
+                                       `name` = '%s', `nick` = '%s', `addr` = '%s', `network` = '%s',
                                        `birthday` = '%s', `gender` = '%s', `keywords` = %d, `hide` = %d, `nsfw` = %d,
                                        `alias` = '%s', `notify` = '%s', `url` = '%s',
                                        `location` = '%s', `about` = '%s', `generation` = %d, `updated` = '%s',
                                        `server_url` = '%s', `connect` = '%s'
                                WHERE `nurl` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
-                       dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]),
+                       dbesc($contact["avatar"]), dbesc($contact["photo"]), dbesc($contact["thumb"]),
+                       dbesc($contact["micro"]), dbesc($contact["name"]), dbesc($contact["nick"]),
                        dbesc($contact["addr"]), dbesc($contact["network"]), dbesc($contact["birthday"]),
                        dbesc($contact["gender"]), dbesc($contact["keywords"]), intval($contact["hide"]),
                        intval($contact["nsfw"]), dbesc($contact["alias"]), dbesc($contact["notify"]),
index 21578a32954d141b10ff4bd3b601f4305d0b050e..1ef201490c97fe67ebb79efa55cbce3cdfb75f05 100644 (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()),
index 6f951bdf6eade2dcd2321e63f250455892fe152c..606c388458b0268b03c037abd722caba9013c721 100644 (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]),
index d5dbab951eabc0fc4065339a1710485780b2f802..8528ba9ffd521b5b679cbc526cf688dede93de7c 100644 (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]),
index 8c5a479646ec992c98bd0b701e2a3cbdc51d012a..bf0ead4932930d47e7b1fab2fcd9282e55280e56 100644 (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"])));
index 0a1b392169b22dbf3e5748bb4ebbbebc8aa65a25..3927f125ea23030d5add4056be76b13b781afc81 100644 (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)
index 8bf471d3d2ee70f17877c49ab6a38e7990650d7f..a1dab5377993ec033ca1fd028aa2c2a49f1ffd25 100644 (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();