aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/Import & Export/ImageUtils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-05-14 12:06:31 -0400
committerbobzel <zzzman@gmail.com>2023-05-14 12:06:31 -0400
commitcfd353baf7356024dc88c61289755dd6699ae9fd (patch)
tree971b25f07ff19cde5b3f40dc440e6dfa02944e18 /src/client/util/Import & Export/ImageUtils.ts
parent24f9e3ddefb1853cce3f3c51dfbe6183d88bce78 (diff)
parent42afc0250de658fc3e924864bfae5afb4edec335 (diff)
Merge branch 'master' into UI_Update_Eric_Ma
Diffstat (limited to 'src/client/util/Import & Export/ImageUtils.ts')
-rw-r--r--src/client/util/Import & Export/ImageUtils.ts32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/client/util/Import & Export/ImageUtils.ts b/src/client/util/Import & Export/ImageUtils.ts
index 9bd92a316..55d37f544 100644
--- a/src/client/util/Import & Export/ImageUtils.ts
+++ b/src/client/util/Import & Export/ImageUtils.ts
@@ -1,12 +1,11 @@
-import { Doc } from "../../../fields/Doc";
-import { ImageField } from "../../../fields/URLField";
-import { Cast, StrCast, NumCast } from "../../../fields/Types";
-import { Networking } from "../../Network";
-import { Id } from "../../../fields/FieldSymbols";
-import { Utils } from "../../../Utils";
+import { Doc } from '../../../fields/Doc';
+import { ImageField } from '../../../fields/URLField';
+import { Cast, StrCast, NumCast } from '../../../fields/Types';
+import { Networking } from '../../Network';
+import { Id } from '../../../fields/FieldSymbols';
+import { Utils } from '../../../Utils';
export namespace ImageUtils {
-
export const ExtractExif = async (document: Doc): Promise<boolean> => {
const field = Cast(document.data, ImageField);
if (!field) {
@@ -17,23 +16,22 @@ export namespace ImageUtils {
contentSize,
nativeWidth,
nativeHeight,
- exifData: { error, data }
- } = await Networking.PostToServer("/inspectImage", { source });
+ exifData: { error, data },
+ } = await Networking.PostToServer('/inspectImage', { source });
document.exif = error || Doc.Get.FromJson({ data });
const proto = Doc.GetProto(document);
- nativeWidth && (document._height = NumCast(document._width) * nativeHeight / nativeWidth);
- proto["data-nativeWidth"] = nativeWidth;
- proto["data-nativeHeight"] = nativeHeight;
- proto["data-path"] = source;
- proto.contentSize = contentSize ? contentSize : undefined;
+ nativeWidth && (document._height = (NumCast(document._width) * nativeHeight) / nativeWidth);
+ proto['data_nativeWidth'] = nativeWidth;
+ proto['data_nativeHeight'] = nativeHeight;
+ proto['data-path'] = source;
+ proto.data_contentSize = contentSize ? contentSize : undefined;
return data !== undefined;
};
export const ExportHierarchyToFileSystem = async (collection: Doc): Promise<void> => {
- const a = document.createElement("a");
+ const a = document.createElement('a');
a.href = Utils.prepend(`/imageHierarchyExport/${collection[Id]}`);
a.download = `Dash Export [${StrCast(collection.title)}].zip`;
a.click();
};
-
-} \ No newline at end of file
+}