]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Images.php
Security: Use htmlspecialchars() for user input in Arguments class
[friendica.git] / src / Util / Images.php
index 4fa2eda04ad525f8a13600af30d7ddc3db04435e..6874d36e9bc3e7d93fd8e719fbd37b7b9744c929 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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
         */
@@ -207,7 +208,7 @@ class Images
        /**
         * Gets info from URL uncached
         *
-        * @param string $url URL
+        * @param string $url
         * @return array Info array
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
@@ -244,6 +245,12 @@ class Images
                }
 
                if ($data) {
+                       $image = new Image($img_str);
+
+                       if ($image->isValid()) {
+                               $data['blurhash'] = $image->getBlurHash();
+                       }
+
                        $data['size'] = $filesize;
                }