- Catalogo: qualità di stampa, margini. ora è 300 DPI.

This commit is contained in:
Surya Paolo
2024-12-05 14:12:51 +01:00
parent c914555a5f
commit 8803190313
12 changed files with 296804 additions and 1450 deletions

View File

@@ -4011,6 +4011,16 @@ module.exports = {
return path.dirname(filename);
},
async deleteFile(filePath) {
try {
await fs.promises.unlink(filePath);
console.log(`File eliminato con successo: ${filePath}`);
} catch (err) {
console.error(`Errore durante l'eliminazione del file: ${filePath}`, err);
throw err;
}
},
delete(mypath, alsothumb, callback) {
fs.unlink(mypath, function (err) {
@@ -4097,7 +4107,11 @@ module.exports = {
},
isFileExists(filename) {
return fs.existsSync(filename);
try {
return fs.existsSync(filename);
} catch (e) {
return false
}
},
getiPAddressUser(req) {
@@ -4400,7 +4414,7 @@ module.exports = {
// Controlla se il valore è un numero valido
return !isNaN(value) && value !== null && value !== '';
},
invertescapeslash(mystr) {
return mystr.replace(/Ç/g, '/');
},
@@ -4783,6 +4797,20 @@ module.exports = {
}
},
removeFileExtension(filename) {
// Trova l'ultima occorrenza del punto nel nome del file
const lastDotIndex = filename.lastIndexOf('.');
// Se non c'è un punto o il punto è all'inizio del nome file,
// restituisci il nome file originale
if (lastDotIndex === -1 || lastDotIndex === 0) {
return filename;
}
// Altrimenti, restituisci la parte del nome file prima dell'ultimo punto
return filename.substring(0, lastDotIndex);
},
removeSpanAndDivTags(text) {
// Rimozione dei tag <span> e </span> dalla stringa di testo
const spanRegex = /<span[^>]*>|<\/span>/gi;