simple-photo-gallery 2.0.11-rc.6 → 2.0.11-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@ import path7 from 'path';
8
8
  import { Buffer } from 'buffer';
9
9
  import sharp2 from 'sharp';
10
10
  import { encode } from 'blurhash';
11
- import ExifReader from 'exifreader';
12
11
  import { GalleryDataSchema, GalleryDataDeprecatedSchema } from '@simple-photo-gallery/common';
12
+ import ExifReader from 'exifreader';
13
13
  import ffprobe from 'node-ffprobe';
14
14
  import os from 'os';
15
15
  import Conf from 'conf';
@@ -46,22 +46,6 @@ async function cropAndResizeImage(image, outputPath, width, height, format = "av
46
46
  withoutEnlargement: true
47
47
  }).toFormat(format).toFile(outputPath);
48
48
  }
49
- async function getImageDescription(imagePath) {
50
- try {
51
- const tags = await ExifReader.load(imagePath);
52
- if (tags.description?.description) return tags.description.description;
53
- if (tags.ImageDescription?.description) return tags.ImageDescription.description;
54
- if (tags.UserComment && typeof tags.UserComment === "object" && tags.UserComment !== null && "description" in tags.UserComment) {
55
- return tags.UserComment.description;
56
- }
57
- if (tags.ExtDescrAccessibility?.description) return tags.ExtDescrAccessibility.description;
58
- if (tags["Caption/Abstract"]?.description) return tags["Caption/Abstract"].description;
59
- if (tags.XPTitle?.description) return tags.XPTitle.description;
60
- if (tags.XPComment?.description) return tags.XPComment.description;
61
- } catch {
62
- return void 0;
63
- }
64
- }
65
49
  async function createImageThumbnails(image, metadata, outputPath, outputPathRetina, size) {
66
50
  const originalWidth = metadata.width || 0;
67
51
  const originalHeight = metadata.height || 0;
@@ -499,6 +483,22 @@ async function getFileMtime(filePath) {
499
483
  const stats = await promises.stat(filePath);
500
484
  return stats.mtime;
501
485
  }
486
+ async function getImageDescription(image) {
487
+ try {
488
+ const tags = await ExifReader.load(image);
489
+ if (tags.description?.description) return tags.description.description;
490
+ if (tags.ImageDescription?.description) return tags.ImageDescription.description;
491
+ if (tags.UserComment && typeof tags.UserComment === "object" && tags.UserComment !== null && "description" in tags.UserComment) {
492
+ return tags.UserComment.description;
493
+ }
494
+ if (tags.ExtDescrAccessibility?.description) return tags.ExtDescrAccessibility.description;
495
+ if (tags["Caption/Abstract"]?.description) return tags["Caption/Abstract"].description;
496
+ if (tags.XPTitle?.description) return tags.XPTitle.description;
497
+ if (tags.XPComment?.description) return tags.XPComment.description;
498
+ } catch {
499
+ return void 0;
500
+ }
501
+ }
502
502
  async function getVideoDimensions(filePath) {
503
503
  const data = await ffprobe(filePath);
504
504
  const videoStream = data.streams.find((stream) => stream.codec_type === "video");
@@ -1157,7 +1157,7 @@ async function waitForUpdateCheck(checkPromise) {
1157
1157
  // package.json
1158
1158
  var package_default = {
1159
1159
  name: "simple-photo-gallery",
1160
- version: "2.0.11-rc.6"};
1160
+ version: "2.0.11-rc.8"};
1161
1161
 
1162
1162
  // src/index.ts
1163
1163
  var program = new Command();