Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active September 26, 2022 20:47
Show Gist options
  • Save aaronpk/0e3291556090f05862f8ab06a8e4baf4 to your computer and use it in GitHub Desktop.
Save aaronpk/0e3291556090f05862f8ab06a8e4baf4 to your computer and use it in GitHub Desktop.

Source Files

Photos are stored in this structure, Y/M/D/photo_id/...

2022/
    /08/
       /12/
          /XXXXXXXXXXXXXX/
                         /info/photo.json
                         /info/sizes.json
                         /info/exif.json
                         /info/comments.json
                         /sizes/XXXXXXXXXXXXXX_k.jpg
                         /sizes/XXXXXXXXXXXXXX_b.jpg
                         /sizes/....
                         XXXXXXXXXXXXXX.jpg
          /XXXXXXXXXXXXXX/
                         /info/photo.json
                         /info/sizes.json
                         /info/exif.json
                         /info/comments.json
                         /sizes/XXXXXXXXXXXXXX_k.jpg
                         /sizes/XXXXXXXXXXXXXX_b.jpg
                         /sizes/....
                         XXXXXXXXXXXXXX.jpg
       /13/
          /XXXXXXXXXXXXXX/
                         /info/photo.json
                         /info/sizes.json
                         /info/exif.json
                         /info/comments.json
                         /sizes/XXXXXXXXXXXXXX_k.jpg
                         /sizes/XXXXXXXXXXXXXX_b.jpg
                         /sizes/....
                         XXXXXXXXXXXXXX.jpg

There is also the file with each tag and which photos are tagged with that:

index/tags.json
{
    "selfie": [
        "46556405272",
        "32995287758",
        "46827353834",
        "47557767952",
        "46711532755"
    ],
    "edit": [
        "46556405272",
        "33718850288"
    ],
    ...
}

People are stored in index/people.json, and contain info about the person as well as the list of photos tagged with that person.

Output

The desired output is a website you can browse just by opening up the file on disk, or publish to a server. That means filling in this folder structure with index.html files based on some templates. For example:

index.html
2022/index.html
    /08/index.html
       /12/index.html
          /XXXXXXXXXXXXXX/index.html
       /13/index.html
    /09/index.html
tags/index.html
    /selfie/index.html
           /2/index.html
           /3/index.html
    /edit/index.html
people/index.html
      /a/index.html
        /2/index.html
      /b/index.html
albums/index.html
      /cheese/index.html
             /2/index.html
      /broccoli/index.html
               /2/index.html
              

Each year, month and day folder should have its own index.html file to list the photos from that day.

The tags, people and albums should have their own index pages listing out all of the items, and for each value there's another index page with all the photos.

Pagination will probably be important, I've indicated that with subfolders like 2 and 3 above, but I'm open to alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment