mirror of
https://github.com/friendica/friendica
synced 2025-05-19 13:44:10 +02:00
Added handling as infinity if maxfilesize is set to 0
This commit is contained in:
parent
ca7af7a64b
commit
97a3587e58
2 changed files with 16 additions and 1 deletions
|
@ -576,6 +576,11 @@ class Photo
|
|||
|
||||
$filesize = strlen($image->asString());
|
||||
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
|
||||
if ($maximagesize == 0) {
|
||||
$maximagesize = INF;
|
||||
}
|
||||
|
||||
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') {
|
||||
|
@ -968,6 +973,10 @@ class Photo
|
|||
|
||||
$maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
|
||||
if ($maximagesize == 0) {
|
||||
$maximagesize = INF;
|
||||
}
|
||||
|
||||
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
|
||||
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
|
||||
foreach ([5120, 2560, 1280, 640] as $pixels) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue