1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

fixing thumbnail error

This commit is contained in:
Patrik J. Braun 2018-12-19 22:28:20 +01:00
parent c81e070f1c
commit 9e710e9039
3 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import {DirectoryDTO} from '../../../common/entities/DirectoryDTO';
import {CameraMetadata, GPSMetadata, PhotoDTO, PhotoMetadata} from '../../../common/entities/PhotoDTO';
import {PhotoDTO, PhotoMetadata} from '../../../common/entities/PhotoDTO';
import {Logger} from '../../Logger';
import {IptcParser} from 'ts-node-iptc';
import {ExifParserFactory, OrientationTypes} from 'ts-exif-parser';
@ -9,9 +9,9 @@ import {FfprobeData} from 'fluent-ffmpeg';
import {ProjectPath} from '../../ProjectPath';
import {Config} from '../../../common/config/private/Config';
import {VideoDTO, VideoMetadata} from '../../../common/entities/VideoDTO';
import {MediaDimension} from '../../../common/entities/MediaDTO';
import {FFmpegFactory} from '../FFmpegFactory';
import {FileDTO} from '../../../common/entities/FileDTO';
import * as sizeOf from 'image-size';
const LOG_TAG = '[DiskManagerTask]';
@ -240,11 +240,17 @@ export class DiskMangerWorker {
} else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) {
metadata.size = {width: exif.tags.RelatedImageWidth, height: exif.tags.RelatedImageHeight};
} else {
metadata.size = {width: 1, height: 1};
const info = sizeOf(fullPath);
metadata.size = {width: info.width, height: info.height};
}
} catch (err) {
Logger.debug(LOG_TAG, 'Error parsing exif', fullPath, err);
metadata.size = {width: 1, height: 1};
try {
const info = sizeOf(fullPath);
metadata.size = {width: info.width, height: info.height};
} catch (e) {
metadata.size = {width: 1, height: 1};
}
}
try {

View File

@ -24,7 +24,7 @@ export class FixOrientationPipe implements PipeTransform {
// set proper canvas dimensions before transform & export
if (OrientationTypes.BOTTOM_LEFT < orientation &&
orientation < OrientationTypes.LEFT_BOTTOM) {
orientation <= OrientationTypes.LEFT_BOTTOM) {
// noinspection JSSuspiciousNameCombination
canvas.width = height;
// noinspection JSSuspiciousNameCombination

View File

@ -35,6 +35,7 @@
"ejs": "2.6.1",
"express": "4.16.4",
"fluent-ffmpeg": "2.1.2",
"image-size": "0.6.3",
"jimp": "0.6.0",
"locale": "0.1.0",
"reflect-metadata": "0.1.12",
@ -69,6 +70,7 @@
"@types/express": "4.16.0",
"@types/fluent-ffmpeg": "2.1.8",
"@types/gm": "1.18.2",
"@types/image-size": "0.0.29",
"@types/jasmine": "3.3.0",
"@types/node": "10.12.12",
"@types/sharp": "0.21.0",