$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);
// Get the relevant size limits for uploads. Abbreviated var names: MaxImageSize -> mis; upload_max_filesize -> umf
$mis_bytes = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
$umf_bytes = Strings::getBytesFromShorthand(ini_get('upload_max_filesize'));
- // Per Friendica definition a value of '0' mean unlimited:
+
+ // Per Friendica definition a value of '0' means unlimited:
If ($mis_bytes == 0) {
$mis_bytes = INF;
}
+
// When PHP is configured with upload_max_filesize less than maximagesize provide this lower limit.
$maximagesize_Mbytes = (is_numeric($mis_bytes) && ($mis_bytes < $umf_bytes) ? $mis_bytes : $umf_bytes) / (1048576);
$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') {
$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) {