]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Images.php
Friendica copyright changed from 2023 to 2034
[friendica.git] / src / Util / Images.php
index aed72f065b7c8c0810efa22c0aaa938ca6c7c46c..b44b1fb8f558fe0a4dbc76078dc531e4dc8a8155 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -249,17 +249,19 @@ class Images
                        return [];
                }
 
-               if ($data) {
-                       $image = new Image($img_str);
+               if (!$data) {
+                       return [];
+               }
 
-                       if ($image->isValid()) {
-                               $data['blurhash'] = $image->getBlurHash();
-                       }
+               $image = new Image($img_str);
 
-                       $data['size'] = $filesize;
+               if ($image->isValid()) {
+                       $data['blurhash'] = $image->getBlurHash();
                }
 
-               return is_array($data) ? $data : [];
+               $data['size'] = $filesize;
+
+               return $data;
        }
 
        /**
@@ -352,4 +354,15 @@ class Images
 
                return '[img=' . $photo . ']' . $description . '[/img]';
        }
+
+       /**
+        * Get the maximum possible upload size in bytes
+        *
+        * @return integer
+        */
+       public static function getMaxUploadBytes(): int
+       {
+               $upload_size = ini_get('upload_max_filesize') ?: DI::config()->get('system', 'maximagesize');
+               return Strings::getBytesFromShorthand($upload_size);
+       }
 }