Created
July 20, 2025 14:43
-
-
Save moorchegue/427df10b666c639a8462851c59ae2999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env fish | |
| set title (basename (dirname $argv[1])) | |
| #set title (echo (basename (dirname $argv[1])) | sed 's/[._]/ /g') | |
| echo "<html><head><title>$title</title>" | |
| echo ' <style>' | |
| echo ' hr { border: none; border-bottom: #999 1px dashed; }' | |
| echo ' img { width: auto; height: 100%; }' | |
| echo ' </style>' | |
| echo ' <meta http-equiv=Content-Type content="text/html;charset=UTF-8">' | |
| echo ' <script src="https://cdn.jsdelivr.net/npm/exif-js"></script>' | |
| echo '</head><body>' | |
| echo '<h3><a href="/">← home</a></h3>' | |
| echo '<center>' | |
| set i 0 | |
| for file in $argv | |
| set i (math $i + 1) | |
| echo '<a name="'$i'" href="#'(math $i + 1)'"><img src="'$file'" /></a>' | |
| echo '<hr /><br />' | |
| end | |
| echo '</center>' | |
| echo '<script>' | |
| echo '"use strict";' | |
| echo 'window.onload=getExif;' | |
| echo 'function getExif() {' | |
| echo ' var imgs = document.getElementsByTagName("img");' | |
| echo ' for (var i=0; i<imgs.length; i++) {' | |
| echo ' let img = imgs[i];' | |
| echo ' EXIF.getData(img, function() {' | |
| echo ' var meta = EXIF.getAllTags(this);' | |
| echo ' img.title = `Artist: ${meta.Artist}' | |
| echo ' Camera: ${meta.Model}' | |
| echo ' Lens: ${meta.undefined}' | |
| echo ' Aperture: f${meta.FNumber}' | |
| echo ' Exposure: ${meta.ExposureTime?.numerator}/${meta.ExposureTime?.denominator}' | |
| echo ' ISO: ${meta.ISOSpeedRatings}' | |
| echo ' ${meta.ImageDescription}`' | |
| echo ' .replace(/(\n)\s+/g, "$1");' | |
| echo ' });' | |
| echo ' }' | |
| echo '}' | |
| echo '</script>' | |
| echo '</body></html>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment