]> git.mxchange.org Git - friendica.git/blobdiff - include/Photo.php
Merge remote-tracking branch 'refs/remotes/friendica/develop' into develop
[friendica.git] / include / Photo.php
index 014cca7d25f70d22bc4cf195106f7d06a6cc1179..828dce82d7a33088c4bae02e1c350104a6e58114 100644 (file)
@@ -283,7 +283,7 @@ class Photo {
                        do {
 
                                // FIXME - implement horizantal bias for scaling as in followin GD functions
-                               // to allow very tall images to be constrained only horizontally. 
+                               // to allow very tall images to be constrained only horizontally.
 
                                $this->image->scaleImage($dest_width, $dest_height);
                        } while ($this->image->nextImage());
@@ -794,8 +794,6 @@ function update_contact_avatar($avatar, $uid, $cid, $force = false) {
 
 function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
 
-       $a = get_app();
-
        $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)
@@ -841,9 +839,9 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = 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();
+               $photo = App::get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
+               $thumb = App::get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
+               $micro = App::get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
        } else {
                $photo_failure = true;
        }
@@ -853,9 +851,9 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = 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';
+               $photo = App::get_baseurl() . '/images/person-175.jpg';
+               $thumb = App::get_baseurl() . '/images/person-80.jpg';
+               $micro = App::get_baseurl() . '/images/person-48.jpg';
        }
 
        return(array($photo,$thumb,$micro));
@@ -945,7 +943,7 @@ function scale_image($width, $height, $max) {
        return array("width" => $dest_width, "height" => $dest_height);
 }
 
-function store_photo($a, $uid, $imagedata = "", $url = "") {
+function store_photo(App $a, $uid, $imagedata = "", $url = "") {
        $r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
                WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
                intval($uid));
@@ -1044,18 +1042,18 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
                return(array());
        }
 
-       $image = array("page" => $a->get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash,
-                       "full" => $a->get_baseurl()."/photo/{$hash}-0.".$ph->getExt());
+       $image = array("page" => App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash,
+                       "full" => App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt());
 
        if ($width > 800 || $height > 800) {
-               $image["large"] = $a->get_baseurl()."/photo/{$hash}-0.".$ph->getExt();
+               $image["large"] = App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt();
        }
 
        if ($width > 640 || $height > 640) {
                $ph->scaleImage(640);
                $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 1, 0, $defperm);
                if ($r) {
-                       $image["medium"] = $a->get_baseurl()."/photo/{$hash}-1.".$ph->getExt();
+                       $image["medium"] = App::get_baseurl()."/photo/{$hash}-1.".$ph->getExt();
                }
        }
 
@@ -1063,7 +1061,7 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
                $ph->scaleImage(320);
                $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 2, 0, $defperm);
                if ($r) {
-                       $image["small"] = $a->get_baseurl()."/photo/{$hash}-2.".$ph->getExt();
+                       $image["small"] = App::get_baseurl()."/photo/{$hash}-2.".$ph->getExt();
                }
        }
 
@@ -1088,7 +1086,7 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
 
                $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 3, 0, $defperm);
                if ($r) {
-                       $image["thumb"] = $a->get_baseurl()."/photo/{$hash}-3.".$ph->getExt();
+                       $image["thumb"] = App::get_baseurl()."/photo/{$hash}-3.".$ph->getExt();
                }
        }