]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Images.php
messages.po and and corrected typo in comment
[friendica.git] / src / Util / Images.php
index 20212e49538362ad3d643524c529f2169e106649..a6a9f4f7db78f66255bf86f9dbf457521742afa6 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\Core\Logger;
 use Friendica\DI;
 use Friendica\Model\Photo;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
+use Friendica\Object\Image;
 
 /**
  * Image utilities
@@ -179,7 +180,7 @@ class Images
        /**
         * Gets info array from given URL, cached data has priority
         *
-        * @param string $url URL
+        * @param string $url
         * @return array Info
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
@@ -206,7 +207,8 @@ class Images
 
        /**
         * Gets info from URL uncached
-        * @param string $url URL
+        *
+        * @param string $url
         * @return array Info array
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
@@ -243,10 +245,16 @@ class Images
                }
 
                if ($data) {
+                       $image = new Image($img_str);
+
+                       if ($image->isValid()) {
+                               $data['blurhash'] = $image->getBlurHash();
+                       }
+
                        $data['size'] = $filesize;
                }
 
-               return $data;
+               return is_array($data) ? $data : [];
        }
 
        /**