1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-28 08:58:49 +02:00

exif test

This commit is contained in:
Braun Patrik 2017-07-11 09:32:28 +02:00
parent cca4ceead0
commit 7478c5106b
2 changed files with 20 additions and 2 deletions

View File

@ -10,6 +10,19 @@ declare module "node-iptc" {
declare module "exif-parser" {
export function create(data): any;
export interface ExifData {
tags: any;
imageSize: any;
}
export interface ExifObject {
parse(): ExifData;
}
export function create(data: any): ExifObject;
export function enableTagNames(value: boolean);
export function enableImageSize(value: boolean);
export function enableReturnTags(value: boolean);
}

View File

@ -11,6 +11,9 @@ import {ProjectPath} from "../../ProjectPath";
const LOG_TAG = "[DiskManagerTask]";
exif_parser.enableTagNames(true);
exif_parser.enableImageSize(true);
exif_parser.enableReturnTags(true);
export class DiskMangerWorker {
private static isImage(fullPath: string) {
let imageMimeTypes = [
@ -50,8 +53,10 @@ export class DiskMangerWorker {
fs.stat(fullPath, (err, data) => {
metadata.fileSize = data.size;
});
try {
const exif = exif_parser.create(data).parse();
Logger.debug(LOG_TAG, "exif data", exif);
metadata.cameraData = <CameraMetadata> {
ISO: exif.tags.ISO,
model: exif.tags.Model,