mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
fixing date issue #136
This commit is contained in:
parent
2f982ba8e3
commit
b8557ad9b0
@ -142,7 +142,8 @@ export class MetadataLoader {
|
||||
}
|
||||
|
||||
if (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) {
|
||||
metadata.creationDate = (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) * 1000;
|
||||
metadata.creationDate = (exif.tags.DateTimeOriginal || exif.tags.CreateDate || exif.tags.ModifyDate) * 1000;
|
||||
|
||||
}
|
||||
|
||||
if (exif.tags.Orientation) {
|
||||
|
BIN
test/backend/assets/date_issue.jpg
Normal file
BIN
test/backend/assets/date_issue.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
17
test/backend/assets/date_issue.json
Normal file
17
test/backend/assets/date_issue.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"cameraData": {
|
||||
"ISO": 500,
|
||||
"exposure": 0.03333333333333333,
|
||||
"fStop": 2,
|
||||
"focalLength": 2.96,
|
||||
"make": "HUAWEI",
|
||||
"model": "HUAWEI G6-L11"
|
||||
},
|
||||
"creationDate": 1460826466000,
|
||||
"fileSize": 1980,
|
||||
"orientation": 1,
|
||||
"size": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
}
|
||||
}
|
@ -11,10 +11,10 @@ describe('DiskMangerWorker', () => {
|
||||
Config.Server.Media.folder = path.join(__dirname, '/../../../assets');
|
||||
ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets');
|
||||
const dir = await DiskMangerWorker.scanDirectory('/');
|
||||
expect(dir.media.length).to.be.equals(4);
|
||||
expect(dir.media.length).to.be.equals(5);
|
||||
const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json'));
|
||||
expect(Utils.clone(dir.media[1].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
|
||||
expect(Utils.clone(dir.media[1].metadata)).to.be.deep.equal(expected);
|
||||
expect(Utils.clone(dir.media[2].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
|
||||
expect(Utils.clone(dir.media[2].metadata)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -24,6 +24,12 @@ describe('MetadataLoader', () => {
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should load miss dated jpg', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/date_issue.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/date_issue.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
|
||||
it('should load jpg 2', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/old_photo.jpg'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user