diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index d7761557f22..6268148fdb5 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -494,10 +494,17 @@ if (!empty($mysoc->logo_mini)) { print ''; } print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; -} else { - print '
'; - print ''; - print '
'; +} elseif (!empty($mysoc->logo)) { + if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + print '
'; + print ''; + print '
'; + print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; + } else { + print '
'; + print ''; + print '
'; + } } print ''; print ''; @@ -514,10 +521,18 @@ if (!empty($mysoc->logo_squarred_mini)) { print ''; } print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; -} else { - print '
'; - print ''; - print '
'; +} elseif (!empty($mysoc->logo_squarred)) { + if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) { + print '
'; + print ''; + print '
'; + print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; + } + else { + print '
'; + print ''; + print '
'; + } } print ''; print ''; diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 13918b908ad..0822d3edd4b 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -33,14 +33,15 @@ $quality = 80; * Return if a filename is file name of a supported image format * * @param string $file Filename + * @param int $acceptsvg 0=Default (depends on setup), 1=Always accept SVG as image files * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP */ -function image_format_supported($file) +function image_format_supported($file, $acceptsvg = 0) { global $conf; $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php - if (! empty($conf->global->MAIN_ALLOW_PREVIEW_OF_UPLOADED_SVG_FILES)) { + if ($acceptsvg || ! empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) { $regeximgext .= '|\.svg'; // Not allowed by default. SVG can contains javascript }