Added getBytesFromShorthand at the remaining places.
This commit is contained in:
parent
97a3587e58
commit
bb9afc520b
2 changed files with 11 additions and 2 deletions
|
@ -26,6 +26,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
|
@ -168,7 +169,11 @@ class Upload extends \Friendica\BaseModule
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$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) {
|
if (!empty($maximagesize) && $filesize > $maximagesize) {
|
||||||
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
|
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
|
||||||
|
|
|
@ -53,7 +53,11 @@ class Index extends BaseSettings
|
||||||
|
|
||||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
$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) {
|
if ($maximagesize && $filesize > $maximagesize) {
|
||||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||||
|
|
Loading…
Reference in a new issue