X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FPhoto.php;h=828dce82d7a33088c4bae02e1c350104a6e58114;hb=0179bc7f0000d773dfd64cfc8f8f97dca20a1ec4;hp=6a7cc3e52c10e93841be33fa7fa3f09c2e650770;hpb=e446e9571f1da818afbd5a3316043d47b16978fa;p=friendica.git diff --git a/include/Photo.php b/include/Photo.php index 6a7cc3e52c..828dce82d7 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -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()); @@ -707,11 +707,6 @@ class Photo { ); } - // Update the cached values - if ($album != 'Contact Photos') { - photo_albums($uid, true); - } - return $r; } } @@ -799,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) @@ -846,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; } @@ -858,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)); @@ -872,7 +865,7 @@ function get_photo_info($url) { $data = Cache::get($url); - if (is_null($data) OR !$data) { + if (is_null($data) OR !$data OR !is_array($data)) { $img_str = fetch_url($url, true, $redirects, 4); $filesize = strlen($img_str); @@ -950,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)); @@ -1049,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(); } } @@ -1068,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(); } } @@ -1093,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(); } }