Display max filesize for profile image #1451

This commit is contained in:
Kijin Sung 2020-10-30 17:07:37 +09:00
parent b354d8af49
commit 921c318bb0
3 changed files with 13 additions and 1 deletions

View file

@ -575,9 +575,19 @@ class memberAdminView extends member
{
$inputTag = sprintf('<input type="hidden" name="__%s_exist" value="false" />', $formInfo->name);
}
$inputTag .= sprintf('<input type="file" name="%s" id="%s" value="" accept="image/*" /><p class="help-block">%s: %dpx, %s: %dpx</p>',
$max_filesize = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')));
if (isset($member_config->{$formInfo->name.'_max_filesize'}))
{
$max_filesize = min($max_filesize, $member_config->{$formInfo->name.'_max_filesize'} * 1024);
}
$inputTag .= sprintf('<input type="file" name="%s" id="%s" value="" accept="image/*" data-max-filesize="%d" data-max-filesize-error="%s" /><p class="help-block">%s: %s, %s: %dpx, %s: %dpx</p>',
$formInfo->name,
$formInfo->name,
$max_filesize,
escape(lang('file.allowed_filesize_exceeded')),
lang('file.allowed_filesize'),
FileHandler::filesize($max_filesize),
$lang->{$formInfo->name.'_max_width'},
$member_config->{$formInfo->name.'_max_width'},
$lang->{$formInfo->name.'_max_height'},