GrowLogGen
==========

Rebuilds index.html / gallery.html's FILES[] and orientations.js from
whatever's actually sitting in the site folder, and generates any
missing thumbnails -- all in-process, no external tools.

  - Thumbnailing: Img.bas / mIJL.bas / cDIBSection.cls, ported
    directly from the thumb.exe project (same resize + Intel JPEG
    Library encode path, just called as functions instead of shelling
    a separate exe). ijl11.dll must sit next to the compiled
    GrowLogGen.exe -- it's included in this package.
  - EXIF orientation: modExif.bas, reads the Orientation tag via
    GDI+ (gdiplus.dll), which ships on every Windows box since XP
    SP2. No third-party EXIF library, no Python, nothing to build.

SETUP (one time)
-----------------
1. Open GrowLogGen.vbp in VB6.
2. Project > References -- nothing extra needed, everything here is
   late-bound Declares or already in the project.
3. Copy ijl11.dll next to wherever you compile/run GrowLogGen.exe.
4. Compile (or just hit Run for testing).

USAGE
-----
Run All does everything in order:
  1. Scan          - lists every .jpg/.jpeg/.png directly in the site
                      folder (not thumbs\), sorted the same way
                      FILES.sort() sorts them in the browser, flags
                      any missing a thumbnail.
  2. Thumbs         - for each file missing a thumb: load it, resize
                      it via Img.CreateThumb, save it straight to
                      thumbs\_thumb_<basename>.jpg. No scratch folder,
                      no temp copies -- runs directly against the
                      real thumbs\ folder now that there's no second
                      process to keep out of each other's way.
  3. Orientations   - reads the EXIF Orientation tag on every file via
                      GDI+, writes orientations.js.
  4. FILES          - regenerates the FILES[] block and writes it into
                      both index.html and gallery.html between the
                      // ===== FILES:BEGIN ===== / FILES:END ===== markers.
                      (Already added to your current index.html/gallery.html
                      in this delivery -- keep those markers if you
                      hand-edit those files later, or the write step
                      will just report "markers not found" and leave
                      the file alone.)

Each step can also be run individually -- e.g. just Update
orientations.js after fixing a rotated photo by hand.

Thumb width/height default to 200x200 -- check what your existing
_thumb_* files actually measure before your first real run and adjust
if it's off, or new thumbs won't match the old ones' resolution.

KNOWN LIMITATIONS
------------------
- Img.bas's Bmp2Jpg always saves JPG -- there's no "keep original
  format" mode, so a .png source's thumb comes out as
  _thumb_<name>.jpg. gallery.html's thumbPath() already accounts for
  this (always assumes .jpg for the thumb regardless of the source
  extension) -- see the patched gallery.html in this delivery.
- Sort order matches JS's default Array.sort() only for plain-ASCII
  filenames (which is what the naming convention produces). Don't
  drop filenames with non-ASCII characters into the folder.
- The GDI+ PropertyItem struct layout in modExif.bas is the standard
  documented one, but wasn't testable in this environment (no VB6
  compiler here) -- sanity-check the first orientations.js it
  produces against a couple of photos you know are rotated before
  trusting it on the full set.

WHAT WAS ALREADY DRIFTING (found while reading the existing files)
--------------------------------------------------------------------
- orientations.js has a stale key, "2025-08-04_052632 (2).jpg", that
  matches nothing in either FILES array -- leftover from a rename.
  It'll disappear next time orientations.js is regenerated.
- _index.html (the older copy) still lists a few files with .jpeg
  where index.html/gallery.html have since been normalized to .jpg.
  _index.html looks superseded -- worth deleting once GrowLogGen is
  live, so there's only one copy to go stale.

THUMBNAIL PATH REWRITE (this update)
--------------------------------------
The original resize path (CreateThumb -> ResizePict, through the inPic/
Resized pictureboxes in twips) produced, in sequence: a multi-minute
per-pixel GetPixel/SetPixel loop, then silent write failures, then an
overflow in the twips/percent setup math. Img.bas now skips all of it:
loads the source as a StdPicture, computes the target size in pixels
(aspect-preserving, no upscale), and StretchBlts once (HALFTONE) straight
into the 24bpp cDIBSection that SaveJPG already consumes. cDIBSection.cls
gained a public hDC property so Img.bas can blit into it.

Quality unchanged: Global Quality = Medium (75), set in Form_Load.

IF THUMBS STILL "FAIL TO WRITE" AFTER THIS
--------------------------------------------
That message now only fires on a genuine JPEG-encode failure, which in
practice means ijl11.dll isn't being found at runtime. Note that when
running in the VB6 IDE, Declare'd DLLs are searched relative to VB6.EXE
and the PATH, NOT the project folder -- so ijl11.dll sitting next to the
.vbp may not be found until you compile to exe (or drop the dll in
system32/SysWOW64 or on PATH). To see the real error instead of the
swallowed one, temporarily comment the "On Error Resume Next" in
DoGenThumbs and rerun on one file.

FRESH-SHOOT BOOTSTRAP (this update)
-------------------------------------
Update FILES Arrays (and Run All) now seeds a new site folder. If the
folder has no index.html / gallery.html yet, they're copied from the
templates shipped next to the exe (App.Path\templates\) and then patched.
An existing site file is never overwritten -- only its FILES block is
replaced between the markers. So pointing at a bare photo folder now
produces a working slideshow+gallery with one click.

Keep the templates\ folder next to GrowLogGen.exe (in the IDE, that's
the project folder). The templates carry an empty FILES array on purpose
-- it gets filled from the scan on patch.

PNG SOURCES (this update)
---------------------------
VB6's LoadPicture can't read PNG, which is why a .png source failed to
thumbnail. Loading now goes through GDI+ (modExif.LoadHBitmap), which
reads PNG/JPG/GIF/BMP/TIFF alike. Transparent PNG pixels flatten to
black in the thumb (fine for photos; screenshots with transparency are
the only case you'd notice).

DEFAULT MODE = GALLERY (this update)
--------------------------------------
The gallery is now index.html (the page that opens by default); the
slideshow moved to slideshow.html. Cross-links updated both ways
(gallery's "Slideshow" link and per-photo "Open in slideshow" ->
slideshow.html; slideshow's Gallery button and G key -> index.html).
The generator now seeds/patches index.html + slideshow.html. If you
have an OLD site folder with a gallery.html in it, delete the stale
gallery.html by hand once -- the tool won't touch it anymore.
