]> git.mxchange.org Git - friendica.git/blobdiff - include/Photo.php
Merge remote-tracking branch 'upstream/develop' into 1604-cookie
[friendica.git] / include / Photo.php
index e0cb23008ab31abb4bc50d383133a66a1faaa34c..91fce55a86f868c4959291618fa4b8af77c4bba6 100644 (file)
@@ -720,7 +720,17 @@ function guess_image_type($filename, $fromcurl=false) {
 
 }
 
-function update_contact_avatar($avatar,$uid,$cid) {
+/**
+ * @brief Updates the avatar links in a contact only if needed
+ *
+ * @param string $avatar Link to avatar picture
+ * @param int $uid User id of contact owner
+ * @param int $cid Contact id
+ * @param bool $force force picture update
+ *
+ * @return array Returns array of the different avatar sizes
+ */
+function update_contact_avatar($avatar,$uid,$cid, $force = false) {
 
        $r = q("SELECT `avatar`, `photo`, `thumb`, `micro` FROM `contact` WHERE `id` = %d LIMIT 1", intval($cid));
        if (!$r)
@@ -728,7 +738,7 @@ function update_contact_avatar($avatar,$uid,$cid) {
        else
                $data = array($r[0]["photo"], $r[0]["thumb"], $r[0]["micro"]);
 
-       if ($r[0]["avatar"] != $avatar) {
+       if (($r[0]["avatar"] != $avatar) OR $force) {
                $photos = import_profile_photo($avatar,$uid,$cid, true);
 
                if ($photos) {