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:
parent
c81e070f1c
commit
9e710e9039
@ -1,7 +1,7 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {DirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
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 {Logger} from '../../Logger';
|
||||||
import {IptcParser} from 'ts-node-iptc';
|
import {IptcParser} from 'ts-node-iptc';
|
||||||
import {ExifParserFactory, OrientationTypes} from 'ts-exif-parser';
|
import {ExifParserFactory, OrientationTypes} from 'ts-exif-parser';
|
||||||
@ -9,9 +9,9 @@ import {FfprobeData} from 'fluent-ffmpeg';
|
|||||||
import {ProjectPath} from '../../ProjectPath';
|
import {ProjectPath} from '../../ProjectPath';
|
||||||
import {Config} from '../../../common/config/private/Config';
|
import {Config} from '../../../common/config/private/Config';
|
||||||
import {VideoDTO, VideoMetadata} from '../../../common/entities/VideoDTO';
|
import {VideoDTO, VideoMetadata} from '../../../common/entities/VideoDTO';
|
||||||
import {MediaDimension} from '../../../common/entities/MediaDTO';
|
|
||||||
import {FFmpegFactory} from '../FFmpegFactory';
|
import {FFmpegFactory} from '../FFmpegFactory';
|
||||||
import {FileDTO} from '../../../common/entities/FileDTO';
|
import {FileDTO} from '../../../common/entities/FileDTO';
|
||||||
|
import * as sizeOf from 'image-size';
|
||||||
|
|
||||||
const LOG_TAG = '[DiskManagerTask]';
|
const LOG_TAG = '[DiskManagerTask]';
|
||||||
|
|
||||||
@ -240,12 +240,18 @@ export class DiskMangerWorker {
|
|||||||
} else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) {
|
} else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) {
|
||||||
metadata.size = {width: exif.tags.RelatedImageWidth, height: exif.tags.RelatedImageHeight};
|
metadata.size = {width: exif.tags.RelatedImageWidth, height: exif.tags.RelatedImageHeight};
|
||||||
} else {
|
} else {
|
||||||
metadata.size = {width: 1, height: 1};
|
const info = sizeOf(fullPath);
|
||||||
|
metadata.size = {width: info.width, height: info.height};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.debug(LOG_TAG, 'Error parsing exif', fullPath, err);
|
Logger.debug(LOG_TAG, 'Error parsing exif', fullPath, err);
|
||||||
|
try {
|
||||||
|
const info = sizeOf(fullPath);
|
||||||
|
metadata.size = {width: info.width, height: info.height};
|
||||||
|
} catch (e) {
|
||||||
metadata.size = {width: 1, height: 1};
|
metadata.size = {width: 1, height: 1};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const iptcData = IptcParser.parse(data);
|
const iptcData = IptcParser.parse(data);
|
||||||
|
@ -24,7 +24,7 @@ export class FixOrientationPipe implements PipeTransform {
|
|||||||
|
|
||||||
// set proper canvas dimensions before transform & export
|
// set proper canvas dimensions before transform & export
|
||||||
if (OrientationTypes.BOTTOM_LEFT < orientation &&
|
if (OrientationTypes.BOTTOM_LEFT < orientation &&
|
||||||
orientation < OrientationTypes.LEFT_BOTTOM) {
|
orientation <= OrientationTypes.LEFT_BOTTOM) {
|
||||||
// noinspection JSSuspiciousNameCombination
|
// noinspection JSSuspiciousNameCombination
|
||||||
canvas.width = height;
|
canvas.width = height;
|
||||||
// noinspection JSSuspiciousNameCombination
|
// noinspection JSSuspiciousNameCombination
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"ejs": "2.6.1",
|
"ejs": "2.6.1",
|
||||||
"express": "4.16.4",
|
"express": "4.16.4",
|
||||||
"fluent-ffmpeg": "2.1.2",
|
"fluent-ffmpeg": "2.1.2",
|
||||||
|
"image-size": "0.6.3",
|
||||||
"jimp": "0.6.0",
|
"jimp": "0.6.0",
|
||||||
"locale": "0.1.0",
|
"locale": "0.1.0",
|
||||||
"reflect-metadata": "0.1.12",
|
"reflect-metadata": "0.1.12",
|
||||||
@ -69,6 +70,7 @@
|
|||||||
"@types/express": "4.16.0",
|
"@types/express": "4.16.0",
|
||||||
"@types/fluent-ffmpeg": "2.1.8",
|
"@types/fluent-ffmpeg": "2.1.8",
|
||||||
"@types/gm": "1.18.2",
|
"@types/gm": "1.18.2",
|
||||||
|
"@types/image-size": "0.0.29",
|
||||||
"@types/jasmine": "3.3.0",
|
"@types/jasmine": "3.3.0",
|
||||||
"@types/node": "10.12.12",
|
"@types/node": "10.12.12",
|
||||||
"@types/sharp": "0.21.0",
|
"@types/sharp": "0.21.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user