From f67dc7d58f94fa81b989e7e7fa504df65c08aa71 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 5 Sep 2020 20:57:53 +0200 Subject: [PATCH] removing support for GM image library --- package.json | 2 - .../model/diagnostics/ConfigDiagnostics.ts | 20 +------- src/backend/model/threading/PhotoWorker.ts | 47 ------------------- src/common/config/private/PrivateConfig.ts | 3 +- .../photo/photo.settings.component.html | 6 --- src/frontend/translate/messages.en.xlf | 34 ++++---------- src/frontend/translate/messages.fr.xlf | 34 ++++---------- src/frontend/translate/messages.hu.xlf | 36 ++++---------- src/frontend/translate/messages.ro.xlf | 34 ++++---------- src/frontend/translate/messages.ru.xlf | 34 ++++---------- 10 files changed, 49 insertions(+), 201 deletions(-) diff --git a/package.json b/package.json index 932fad5b..136e149d 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "@types/express": "4.17.2", "@types/express-jwt": "0.0.42", "@types/fluent-ffmpeg": "2.1.11", - "@types/gm": "1.18.6", "@types/gulp": "4.0.6", "@types/gulp-zip": "4.0.1", "@types/image-size": "0.8.0", @@ -146,7 +145,6 @@ "@ffmpeg-installer/ffmpeg": "1.0.20", "@ffprobe-installer/ffprobe": "1.0.12", "bcrypt": "3.0.7", - "gm": "1.23.1", "mysql": "2.17.1", "sharp": "0.23.4" }, diff --git a/src/backend/model/diagnostics/ConfigDiagnostics.ts b/src/backend/model/diagnostics/ConfigDiagnostics.ts index 3715335e..787adea5 100644 --- a/src/backend/model/diagnostics/ConfigDiagnostics.ts +++ b/src/backend/model/diagnostics/ConfigDiagnostics.ts @@ -1,7 +1,6 @@ import {Config} from '../../../common/config/private/Config'; import {Logger} from '../../Logger'; import {NotificationManager} from '../NotifocationManager'; -import {ProjectPath} from '../../ProjectPath'; import {SQLConnection} from '../database/sql/SQLConnection'; import * as fs from 'fs'; import {FFmpegFactory} from '../FFmpegFactory'; @@ -86,26 +85,11 @@ export class ConfigDiagnostics { sharp(); } - static async testGM() { - const gm = require('gm'); - await new Promise((resolve, reject) => { - gm(ProjectPath.FrontendFolder + '/assets/icon.png').size((err: Error) => { - if (err) { - return reject(err.toString()); - } - return resolve(); - }); - }); - } - static async testThumbnailLib(processingLibrary: ServerConfig.PhotoProcessingLib) { switch (processingLibrary) { case ServerConfig.PhotoProcessingLib.sharp: await this.testSharp(); break; - case ServerConfig.PhotoProcessingLib.gm: - await this.testGM(); - break; } } @@ -235,8 +219,8 @@ export class ConfigDiagnostics { NotificationManager.warning('Error during initializing SQL falling back temporally to memory DB', err.toString()); Config.Server.Database.type = ServerConfig.DatabaseType.memory; } else { - Logger.error(LOG_TAG, 'Error during initializing SQL DB, check DB connection and settings'); - process.exit(1); + Logger.error(LOG_TAG, 'Error during initializing SQL DB, check DB connection and settings'); + process.exit(1); } } } diff --git a/src/backend/model/threading/PhotoWorker.ts b/src/backend/model/threading/PhotoWorker.ts index 76550d83..8f42437b 100644 --- a/src/backend/model/threading/PhotoWorker.ts +++ b/src/backend/model/threading/PhotoWorker.ts @@ -123,8 +123,6 @@ export class ImageRendererFactory { switch (renderer) { case ServerConfig.PhotoProcessingLib.Jimp: return ImageRendererFactory.Jimp(); - case ServerConfig.PhotoProcessingLib.gm: - return ImageRendererFactory.Gm(); case ServerConfig.PhotoProcessingLib.sharp: return ImageRendererFactory.Sharp(); } @@ -222,49 +220,4 @@ export class ImageRendererFactory { } - public static Gm() { - const gm = require('gm'); - return (input: RendererInput): Promise => { - return new Promise((resolve, reject) => { - Logger.silly('[GMThRenderer] rendering thumbnail:' + input.mediaPath); - let image: State = gm(input.mediaPath); - image.size((err, value: Dimensions) => { - if (err) { - return reject('[GMThRenderer] ' + err.toString()); - } - - /** - * newWidth * newHeight = size*size - * newHeight/newWidth = height/width - * - * newHeight = (height/width)*newWidth - * newWidth * newWidth = (size*size) / (height/width) - * - * @type {number} - */ - try { - const ratio = value.height / value.width; - const filter = input.qualityPriority === true ? 'Lanczos' : 'Point'; - image.filter(filter); - - if (input.makeSquare === false) { - const newWidth = Math.round(Math.sqrt((input.size * input.size) / ratio)); - image = image.resize(newWidth); - } else { - image = image.resize(input.size, input.size) - .crop(input.size, input.size); - } - image.write(input.outPath, (e) => { - if (e) { - return reject('[GMThRenderer] ' + e.toString()); - } - return resolve(); - }); - } catch (err) { - return reject('[GMThRenderer] ' + err.toString()); - } - }); - }); - }; - } } diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index acb17d11..65429cca 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -21,8 +21,7 @@ export module ServerConfig { export enum PhotoProcessingLib { sharp = 3, - Jimp = 1, - gm = 2, + Jimp = 1 } export enum ReIndexingSensitivity { diff --git a/src/frontend/app/ui/settings/photo/photo.settings.component.html b/src/frontend/app/ui/settings/photo/photo.settings.component.html index 27ac8043..7b4adc44 100644 --- a/src/frontend/app/ui/settings/photo/photo.settings.component.html +++ b/src/frontend/app/ui/settings/photo/photo.settings.component.html @@ -22,12 +22,6 @@ Make sure that sharp node module is installed (npm install sharp). - - Make sure that gm node module and - GraphicsMagick - are installed (npm install sharp). - diff --git a/src/frontend/translate/messages.en.xlf b/src/frontend/translate/messages.en.xlf index 353641e7..070cda1d 100644 --- a/src/frontend/translate/messages.en.xlf +++ b/src/frontend/translate/messages.en.xlf @@ -832,7 +832,7 @@ app/ui/settings/photo/photo.settings.component.html - 67 + 61 app/ui/settings/metafiles/metafile.settings.component.html @@ -889,7 +889,7 @@ app/ui/settings/photo/photo.settings.component.html - 71 + 65 app/ui/settings/metafiles/metafile.settings.component.html @@ -1131,7 +1131,7 @@ app/ui/settings/photo/photo.settings.component.html - 55 + 49 Resolution @@ -1244,22 +1244,6 @@ Make sure that sharp node module is installed (npm install sharp). - - Make sure that gm node module and - - app/ui/settings/photo/photo.settings.component.html - 27 - - Make sure that gm node module and - - - are installed (npm install sharp). - - app/ui/settings/photo/photo.settings.component.html - 29 - - are installed (npm install sharp). - Thumbnail generation library @@ -1272,7 +1256,7 @@ Photo converting: app/ui/settings/photo/photo.settings.component.html - 36 + 30 Photo converting: @@ -1280,7 +1264,7 @@ Converting app/ui/settings/photo/photo.settings.component.html - 39 + 33 Converting @@ -1288,7 +1272,7 @@ Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). app/ui/settings/photo/photo.settings.component.html - 40 + 34 Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). @@ -1296,7 +1280,7 @@ On the fly converting app/ui/settings/photo/photo.settings.component.html - 46 + 40 On the fly converting @@ -1304,7 +1288,7 @@ Converts photos on the fly, when they are requested. app/ui/settings/photo/photo.settings.component.html - 47 + 41 Converts photos on the fly, when they are requested. @@ -1312,7 +1296,7 @@ The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. app/ui/settings/photo/photo.settings.component.html - 56 + 50 The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. diff --git a/src/frontend/translate/messages.fr.xlf b/src/frontend/translate/messages.fr.xlf index 0b4e6ba6..c9a85d9b 100644 --- a/src/frontend/translate/messages.fr.xlf +++ b/src/frontend/translate/messages.fr.xlf @@ -832,7 +832,7 @@ app/ui/settings/photo/photo.settings.component.html - 67 + 61 app/ui/settings/metafiles/metafile.settings.component.html @@ -889,7 +889,7 @@ app/ui/settings/photo/photo.settings.component.html - 71 + 65 app/ui/settings/metafiles/metafile.settings.component.html @@ -1131,7 +1131,7 @@ app/ui/settings/photo/photo.settings.component.html - 55 + 49 Resolution @@ -1244,22 +1244,6 @@ Assurez-vous que le module de nœud sharp est installé. - - Make sure that gm node module and - - app/ui/settings/photo/photo.settings.component.html - 27 - - Assurez-vous que le module de noeud gm et - - - are installed (npm install sharp). - - app/ui/settings/photo/photo.settings.component.html - 29 - - sont installés (npm install sharp). - Thumbnail generation library @@ -1272,7 +1256,7 @@ Photo converting: app/ui/settings/photo/photo.settings.component.html - 36 + 30 Photo converting: @@ -1280,7 +1264,7 @@ Converting app/ui/settings/photo/photo.settings.component.html - 39 + 33 Converting @@ -1288,7 +1272,7 @@ Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). app/ui/settings/photo/photo.settings.component.html - 40 + 34 Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). @@ -1296,7 +1280,7 @@ On the fly converting app/ui/settings/photo/photo.settings.component.html - 46 + 40 On the fly converting @@ -1304,7 +1288,7 @@ Converts photos on the fly, when they are requested. app/ui/settings/photo/photo.settings.component.html - 47 + 41 Converts photos on the fly, when they are requested. @@ -1312,7 +1296,7 @@ The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. app/ui/settings/photo/photo.settings.component.html - 56 + 50 The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. diff --git a/src/frontend/translate/messages.hu.xlf b/src/frontend/translate/messages.hu.xlf index 55357218..4a00b32f 100644 --- a/src/frontend/translate/messages.hu.xlf +++ b/src/frontend/translate/messages.hu.xlf @@ -832,7 +832,7 @@ app/ui/settings/photo/photo.settings.component.html - 67 + 61 app/ui/settings/metafiles/metafile.settings.component.html @@ -889,7 +889,7 @@ app/ui/settings/photo/photo.settings.component.html - 71 + 65 app/ui/settings/metafiles/metafile.settings.component.html @@ -1131,7 +1131,7 @@ app/ui/settings/photo/photo.settings.component.html - 55 + 49 Felbontás @@ -1244,22 +1244,6 @@ Győződjön meg arról, hogy a sharp node modul telepítve van (npm telepítés éles). - - Make sure that gm node module and - - app/ui/settings/photo/photo.settings.component.html - 27 - - Győződj meg róla, hogy a gm node modul és - - - are installed (npm install sharp). - - app/ui/settings/photo/photo.settings.component.html - 29 - - telepítve van (npm install sharp). - Thumbnail generation library @@ -1272,7 +1256,7 @@ Photo converting: app/ui/settings/photo/photo.settings.component.html - 36 + 30 Photo konvertálás: @@ -1280,7 +1264,7 @@ Converting app/ui/settings/photo/photo.settings.component.html - 39 + 33 Konvertálás @@ -1288,7 +1272,7 @@ Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). app/ui/settings/photo/photo.settings.component.html - 40 + 34 Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). @@ -1296,7 +1280,7 @@ On the fly converting app/ui/settings/photo/photo.settings.component.html - 46 + 40 Menet közbeni konvetálás @@ -1304,7 +1288,7 @@ Converts photos on the fly, when they are requested. app/ui/settings/photo/photo.settings.component.html - 47 + 41 Photókat menet közvben konvertálja, amikor kérésre megy rájuk. @@ -1312,7 +1296,7 @@ The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. app/ui/settings/photo/photo.settings.component.html - 56 + 50 A konvertált fotó rövidebb oldala lesz ekkora. @@ -2792,4 +2776,4 @@ - + \ No newline at end of file diff --git a/src/frontend/translate/messages.ro.xlf b/src/frontend/translate/messages.ro.xlf index 085bf46e..9540a73f 100644 --- a/src/frontend/translate/messages.ro.xlf +++ b/src/frontend/translate/messages.ro.xlf @@ -832,7 +832,7 @@ app/ui/settings/photo/photo.settings.component.html - 67 + 61 app/ui/settings/metafiles/metafile.settings.component.html @@ -889,7 +889,7 @@ app/ui/settings/photo/photo.settings.component.html - 71 + 65 app/ui/settings/metafiles/metafile.settings.component.html @@ -1131,7 +1131,7 @@ app/ui/settings/photo/photo.settings.component.html - 55 + 49 Resolution @@ -1244,22 +1244,6 @@ Asigurați-vă că modulul node sharp este instalat (npm install sharp). - - Make sure that gm node module and - - app/ui/settings/photo/photo.settings.component.html - 27 - - Asigurați-vă că modulul node gm și - - - are installed (npm install sharp). - - app/ui/settings/photo/photo.settings.component.html - 29 - - sunt instalate (npm install sharp). - Thumbnail generation library @@ -1272,7 +1256,7 @@ Photo converting: app/ui/settings/photo/photo.settings.component.html - 36 + 30 Photo converting: @@ -1280,7 +1264,7 @@ Converting app/ui/settings/photo/photo.settings.component.html - 39 + 33 Converting @@ -1288,7 +1272,7 @@ Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). app/ui/settings/photo/photo.settings.component.html - 40 + 34 Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). @@ -1296,7 +1280,7 @@ On the fly converting app/ui/settings/photo/photo.settings.component.html - 46 + 40 On the fly converting @@ -1304,7 +1288,7 @@ Converts photos on the fly, when they are requested. app/ui/settings/photo/photo.settings.component.html - 47 + 41 Converts photos on the fly, when they are requested. @@ -1312,7 +1296,7 @@ The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. app/ui/settings/photo/photo.settings.component.html - 56 + 50 The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. diff --git a/src/frontend/translate/messages.ru.xlf b/src/frontend/translate/messages.ru.xlf index c46ef939..a4bc28ac 100644 --- a/src/frontend/translate/messages.ru.xlf +++ b/src/frontend/translate/messages.ru.xlf @@ -832,7 +832,7 @@ app/ui/settings/photo/photo.settings.component.html - 67 + 61 app/ui/settings/metafiles/metafile.settings.component.html @@ -889,7 +889,7 @@ app/ui/settings/photo/photo.settings.component.html - 71 + 65 app/ui/settings/metafiles/metafile.settings.component.html @@ -1131,7 +1131,7 @@ app/ui/settings/photo/photo.settings.component.html - 55 + 49 Resolution @@ -1244,22 +1244,6 @@ Убедитесь, что модуль node.js sharp установлен. - - Make sure that gm node module and - - app/ui/settings/photo/photo.settings.component.html - 27 - - Убедитесь, что модуль node.js gm и - - - are installed (npm install sharp). - - app/ui/settings/photo/photo.settings.component.html - 29 - - установлен (npm install sharp). - Thumbnail generation library @@ -1272,7 +1256,7 @@ Photo converting: app/ui/settings/photo/photo.settings.component.html - 36 + 30 Photo converting: @@ -1280,7 +1264,7 @@ Converting app/ui/settings/photo/photo.settings.component.html - 39 + 33 Converting @@ -1288,7 +1272,7 @@ Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). app/ui/settings/photo/photo.settings.component.html - 40 + 34 Downsizes photos for faster preview loading. (Zooming in to the photo loads the original). @@ -1296,7 +1280,7 @@ On the fly converting app/ui/settings/photo/photo.settings.component.html - 46 + 40 On the fly converting @@ -1304,7 +1288,7 @@ Converts photos on the fly, when they are requested. app/ui/settings/photo/photo.settings.component.html - 47 + 41 Converts photos on the fly, when they are requested. @@ -1312,7 +1296,7 @@ The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio. app/ui/settings/photo/photo.settings.component.html - 56 + 50 The shorter edge of the converted photo will be scaled down to this, while keeping the aspect ratio.