]> git.mxchange.org Git - friendica.git/commitdiff
Added getBytesFromShorthand at the remaining places.
authorMarek Bachmann <marek.bachmann@comtec.eecs.uni-kassel.de>
Wed, 30 Nov 2022 03:13:10 +0000 (04:13 +0100)
committerMarek Bachmann <marek.bachmann@comtec.eecs.uni-kassel.de>
Wed, 30 Nov 2022 03:13:10 +0000 (04:13 +0100)
src/Module/Media/Photo/Upload.php
src/Module/Settings/Profile/Photo/Index.php

index c07249c902ee288e7cb6bff60b96e9f00f7fe579..ec8dbcf70ddb7803c3e14ec91d0e30d6a9876c3f 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
 use Friendica\Core\Session\Capability\IHandleUserSessions;
 use Friendica\Database\Database;
+use Friendica\DI;
 use Friendica\Model\Photo;
 use Friendica\Model\User;
 use Friendica\Module\BaseApi;
@@ -168,7 +169,11 @@ class Upload extends \Friendica\BaseModule
                $width  = $image->getWidth();
                $height = $image->getHeight();
 
-               $maximagesize = $this->config->get('system', 'maximagesize');
+               $maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
+
+               if ($maximagesize == 0) {
+                       $maximagesize = INF;
+               }
 
                if (!empty($maximagesize) && $filesize > $maximagesize) {
                        // Scale down to multiples of 640 until the maximum size isn't exceeded anymore
index d58576e757ab74ceb3568d5b222d2d7a92846dee..ee551f88bce17850c22b9c05685fb61eaa432345 100644 (file)
@@ -53,7 +53,11 @@ class Index extends BaseSettings
 
                $filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
 
-               $maximagesize = DI::config()->get('system', 'maximagesize', 0);
+               $maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize', 0));
+
+               if ($maximagesize == 0) {
+                       $maximagesize = INF;
+               }
 
                if ($maximagesize && $filesize > $maximagesize) {
                        DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));