delete old logo/photo from disk when load a new logo/photo
This commit is contained in:
marc 2022-07-24 15:03:32 +02:00
parent 9209c83054
commit d8dfe360ec

View File

@ -555,6 +555,7 @@ if (empty($reshook)) {
//var_dump($object->array_languages);exit;
if (!empty($_FILES['photo']['name'])) {
$current_logo = $object->logo;
$object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
}
@ -784,6 +785,13 @@ if (empty($reshook)) {
}
if ($file_OK) {
if (image_format_supported($_FILES['photo']['name']) > 0) {
if($current_logo != $object->logo) {
$fileimg = $dir.'/'.$current_logo;
$dirthumbs = $dir.'/thumbs';
dol_delete_file($fileimg);
dol_delete_dir_recursive($dirthumbs);
}
dol_mkdir($dir);
if (@is_dir($dir)) {