1
1
Fork 0

Removed redundant maximagesize = INF statements

This commit is contained in:
Marek Bachmann 2022-11-30 05:17:48 +01:00
parent 00808326c2
commit 79235b6db1
4 changed files with 3 additions and 23 deletions

View file

@ -656,10 +656,6 @@ function photos_post(App $a)
$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);

View file

@ -577,11 +577,7 @@ class Photo
$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();
@ -973,11 +969,7 @@ class Photo
$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)) {

View file

@ -171,11 +171,7 @@ class Upload extends \Friendica\BaseModule
$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) {

View file

@ -55,10 +55,6 @@ class Index extends BaseSettings
$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);