$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
- if ($maximagesize == 0) {
- $maximagesize = INF;
- }
-
if ($maximagesize && ($filesize > $maximagesize)) {
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
@unlink($src);
$filesize = strlen($image->asString());
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
- if ($maximagesize == 0) {
- $maximagesize = INF;
- }
-
- if (!empty($maximagesize) && ($filesize > $maximagesize)) {
+ if ($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') {
$image->toStatic();
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
- if ($maximagesize == 0) {
- $maximagesize = INF;
- }
-
- if (!empty($maximagesize) && ($filesize > $maximagesize)) {
+ if ($maximagesize && ($filesize > $maximagesize)) {
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
foreach ([5120, 2560, 1280, 640] as $pixels) {
if (($filesize > $maximagesize) && (max($width, $height) > $pixels)) {
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
- if ($maximagesize == 0) {
- $maximagesize = INF;
- }
-
- if (!empty($maximagesize) && $filesize > $maximagesize) {
+ if ($maximagesize && $filesize > $maximagesize) {
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
foreach ([5120, 2560, 1280, 640] as $pixels) {
if ($filesize > $maximagesize && max($width, $height) > $pixels) {
$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)));
@unlink($src);