mfg92 / hugo-shortcode-gallery

A theme component with a gallery shortcode for the static site generator hugo.
MIT License
359 stars 66 forks source link

About exposure time displays #53

Closed WaltCuller closed 1 year ago

WaltCuller commented 1 year ago

At first, thanks for your awesome gallery project.

In general, the exposure time should be expressed in fractions,like 1/100 1/ 320.

image

But when I used Hugo command to generate the static pages, the exposure time expressed in decimals.

As a temporary solution, I set the fraction expressed exposure time in sidecar files.

mfg92 commented 1 year ago

Thats interessting. Normally a fraction is displayed. There must be something special with your file. Can you provide your example image?

WaltCuller commented 1 year ago

Github can't upload a file size more than 10MB. Any way can I upload? In my opinion, my photos on my MacOS preview is display in fractions, maybe I misused some setting in your project?

At last but important than this issue, Merry Christmas Eve and Have a Good Day!

mfg92 commented 1 year ago

If you zip your image you can upload up to 25MB (https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)

WaltCuller commented 1 year ago

shanghai

mfg92 commented 1 year ago

I finaly had the time to take a deeper look at this issue, here is my analysis:

  1. The EXIF of your photo contains this value for the exposure time: 10/64000
  2. hugo only returns a fraction if the numerator is 1, as it is 10 in your case it calculates the result of the fraction (source)
  3. hugo-shortcode-gallery simply displays what is returned by hugo

There are multiple ways of how we could handle your issue now:

  1. You can use a sidecard file to overrite the exposureTime
  2. You can create a bug ticket for hugo and request that they should return fractions in more cases
  3. You can provide a pullrequest for hugo-shortcode-gallery that contains a function that calculates a fraction in case only a single number is returned by hugo
WaltCuller commented 1 year ago

I forked the Hugo repo. I use my photos and other brands' raw files downloaded from the internet to debug and parse EXIF info. ExposureTime 1/6400',30' would be 10/64000',300/10' when parsing Nikon NEF files or JPEGs generated from NEF. For now, I use the first way as a compromise. And between the second way and the third way, the third way is still a compromise. I will close this issue and try to provide a PR for Hugo. Thanks for your deeper help.