]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Improved definition style
[friendica.git] / src / Model / User.php
index c0b9f71c078ab392dcbdba8e7f099df4565f4c8e..4ef5ffa33c05dba68c5b0698d58e357b79c58ba1 100644 (file)
@@ -839,9 +839,16 @@ class User
                        $photo_failure = false;
 
                        $filename = basename($photo);
-                       $img_str = Network::fetchUrl($photo, true);
-                       // guess mimetype from headers or filename
-                       $type = Images::guessType($photo, true);
+                       $curlResult = Network::curl($photo, true);
+                       if ($curlResult->isSuccess()) {
+                               $img_str = $curlResult->getBody();
+                               $type = $curlResult->getContentType();
+                       } else {
+                               $img_str = '';
+                               $type = '';
+                       }
+
+                       $type = Images::getMimeTypeByData($img_str, $photo, $type);
 
                        $Image = new Image($img_str, $type);
                        if ($Image->isValid()) {
@@ -1330,7 +1337,7 @@ class User
         * @return array The list of the users
         * @throws Exception
         */
-       public static function getUsers($start = 0, $count = Pager::ITEMS_PER_PAGE, $type = 'all', $order = 'contact.name', $order_direction = '+')
+       public static function getList($start = 0, $count = Pager::ITEMS_PER_PAGE, $type = 'all', $order = 'contact.name', $order_direction = '+')
        {
                $sql_order           = '`' . str_replace('.', '`.`', $order) . '`';
                $sql_order_direction = ($order_direction === '+') ? 'ASC' : 'DESC';