Accept several sizes for favicon

This commit is contained in:
Laurent Destailleur 2021-04-18 23:25:47 +02:00
parent 97564bfcc9
commit a1acc896e2
2 changed files with 7 additions and 3 deletions

View File

@ -143,5 +143,5 @@ ConfirmSitemapsCreation=Confirm sitemap generation
SitemapGenerated=Sitemap Generated
ImportFavicon=Favicon
ErrorFaviconType=Favicon must be png
ErrorFaviconSize=Favicon must be of size 32x32
FaviconTooltip=Upload an image which needs to be a png of 32x32
ErrorFaviconSize=Favicon must be sized 16x16, 32x32 or 64x64
FaviconTooltip=Upload an image which needs to be a png (16x16, 32x32 or 64x64)

View File

@ -1362,7 +1362,11 @@ if ($action == 'updatecss' && $usercanedit) {
}
$filetoread = realpath(dol_osencode($_FILES['addedfile']['tmp_name']));
$filesize = getimagesize($filetoread);
if ($filesize[0] != 32 || $filesize[1] != 32) {
if ($filesize[0] != $filesize[1]) {
$error++;
setEventMessages($langs->trans('ErrorFaviconMustBeASquaredImage'), array(), 'errors');
}
if (! $error && ($filesize[0] != 16 || $filesize[0] != 32 || $filesize[0] != 64)) {
$error++;
setEventMessages($langs->trans('ErrorFaviconSize'), array(), 'errors');
}