aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/meta
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/ocda/meta')
-rw-r--r--src/sisudoc/ocda/meta/metadoc_from_src_functions.d18
-rw-r--r--src/sisudoc/ocda/meta/metadoc_object_setter.d3
2 files changed, 21 insertions, 0 deletions
diff --git a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
index 6e4aec3..6a000ea 100644
--- a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
+++ b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
@@ -3208,6 +3208,24 @@ template docAbstractionFunctions() {
writeln("WARNING, image not found or unreadable: ", filename,
"\n ", file_with_path);
}
+ /+ ↓ the image file's own pixel dimensions, which are not the display
+ dimensions carried by the markup (w##h##): those are author set, or
+ where given as w0h0 are derived by _image_dimensions and capped to
+ a maximum display width. Header read only, no decode.
+ +/
+ if (!_file_info.fileMissing) {
+ import imageformats;
+ int _w, _h, _chans;
+ try {
+ read_image_info(file_with_path, _w, _h, _chans);
+ _file_info.imageWidth = _w;
+ _file_info.imageHeight = _h;
+ } catch (Exception ex) {
+ debug(images) {
+ writeln("image dimensions not read: ", filename);
+ }
+ }
+ }
return _file_info;
}
obj.metainfo.sha256.text = obj.text.sha256Of;
diff --git a/src/sisudoc/ocda/meta/metadoc_object_setter.d b/src/sisudoc/ocda/meta/metadoc_object_setter.d
index 7abde64..a88f491 100644
--- a/src/sisudoc/ocda/meta/metadoc_object_setter.d
+++ b/src/sisudoc/ocda/meta/metadoc_object_setter.d
@@ -105,6 +105,9 @@ template ObjectSetter() {
string fileName;
ubyte[32] fileHash_sha256;
ulong fileSize;
+ bool fileMissing = false; // file not found or unreadable, fileHash_sha256 & fileSize unset
+ int imageWidth = 0; // actual pixel dimensions of the
+ int imageHeight = 0; // file, not the display dimensions carried in the markup (w##h##)
}
struct SHA_256_Hashes_ {
char[] summary;