Wrapped all occurrences of DI::config()->get('system', 'maximagesize') with Strings::getBytesFromShorthand()

This commit is contained in:
Marek Bachmann 2022-11-30 02:26:56 +01:00
parent 99e1c64b1a
commit bbd1c34292

View File

@ -575,7 +575,7 @@ class Photo
$image->scaleToSquare(300);
$filesize = strlen($image->asString());
$maximagesize = DI::config()->get('system', 'maximagesize');
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
Logger::info('Avatar exceeds image limit', ['uid' => $uid, 'cid' => $cid, 'maximagesize' => $maximagesize, 'size' => $filesize, 'type' => $image->getType()]);
if ($image->getType() == 'image/gif') {
@ -966,7 +966,7 @@ class Photo
$width = $image->getWidth();
$height = $image->getHeight();
$maximagesize = DI::config()->get('system', 'maximagesize');
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore