Skip to content

Commit ae4ce92

Browse files
authored
Merge pull request #1503 from KodeStar/background_max_file_size
Add current background maxsize #1501
2 parents 966279b + 31f1ba8 commit ae4ce92

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/Helper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ function format_bytes($bytes, bool $is_drive_size = true, string $beforeunit = '
2727
}
2828
}
2929

30+
function parse_size($size) {
31+
$unit = strtolower(substr($size, -1));
32+
$bytes = (int)$size;
33+
switch($unit) {
34+
case 'g': $bytes *= 1024 * 1024 * 1024; break;
35+
case 'm': $bytes *= 1024 * 1024; break;
36+
case 'k': $bytes *= 1024; break;
37+
}
38+
return $bytes;
39+
}
40+
3041
/**
3142
* @param $title
3243
* @param string $separator

resources/views/settings/form.blade.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
<section class="module-container">
22
@if($enable_auth_admin_controls)
3+
34
<header>
4-
<div class="section-title">{{ __($setting->label) }}</div>
5+
<div class="section-title">
6+
{{ __($setting->label) }}
7+
@if($setting->type === 'image')
8+
@php
9+
$max_upload = ini_get('upload_max_filesize');
10+
$max_upload_bytes = parse_size($max_upload);
11+
@endphp
12+
<a class="settinglink" target="_blank" rel="nofollow noreferer" href="https://github.com/linuxserver/Heimdall?tab=readme-ov-file#new-background-image-not-being-set">({{ format_bytes($max_upload_bytes, false) }})</a>
13+
@endif
14+
15+
</div>
516
<div class="module-actions">
617
<button type="submit"class="button"><i class="fa fa-save"></i><span>{{ __('app.buttons.save') }}</span></button>
718
<a href="{{ route('settings.index', []) }}" class="button"><i class="fa fa-ban"></i><span>{{ __('app.buttons.cancel') }}</span></a>

0 commit comments

Comments
 (0)