Wrapped all occurrences of DI::config()->get('system', 'maximagesize') with Strings::getBytesFromShorthand()
This commit is contained in:
parent
99e1c64b1a
commit
bbd1c34292
1 changed files with 2 additions and 2 deletions
|
@ -575,7 +575,7 @@ class Photo
|
||||||
$image->scaleToSquare(300);
|
$image->scaleToSquare(300);
|
||||||
|
|
||||||
$filesize = strlen($image->asString());
|
$filesize = strlen($image->asString());
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||||
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
|
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
|
||||||
Logger::info('Avatar exceeds image limit', ['uid' => $uid, 'cid' => $cid, 'maximagesize' => $maximagesize, 'size' => $filesize, 'type' => $image->getType()]);
|
Logger::info('Avatar exceeds image limit', ['uid' => $uid, 'cid' => $cid, 'maximagesize' => $maximagesize, 'size' => $filesize, 'type' => $image->getType()]);
|
||||||
if ($image->getType() == 'image/gif') {
|
if ($image->getType() == 'image/gif') {
|
||||||
|
@ -966,7 +966,7 @@ class Photo
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
|
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue