Go to file
2024-01-10 15:54:29 -06:00
__tests__ Streamline camera text 2024-01-08 00:17:04 -06:00
.vscode Add ••• admin button to individual photos 2024-01-08 12:52:22 -06:00
public Init 2023-09-05 09:00:57 -05:00
readme Update og image samples in README 2023-10-16 08:53:59 -05:00
src Guard camera query against empty strings 2024-01-10 15:54:29 -06:00
.eslintrc.json Init 2023-09-05 09:00:57 -05:00
.gitignore Init 2023-09-05 09:00:57 -05:00
jest.config.mjs Refactor paths/escape handling, add test coverage 2023-09-29 13:40:08 -05:00
next.config.js Switch to presigned url strategy for S3 2023-11-29 20:03:31 -06:00
package.json Add ••• admin button to individual photos 2024-01-08 12:52:22 -06:00
pnpm-lock.yaml Add ••• admin button to individual photos 2024-01-08 12:52:22 -06:00
postcss.config.js Init 2023-09-05 09:00:57 -05:00
README.md README edits 2024-01-07 14:19:10 -06:00
tailwind.config.js Tweak rotation animation for safari 2023-09-27 10:16:27 -05:00
tsconfig.json Switch to clsx/lite, change TS bundler strategy 2024-01-02 23:25:54 -05:00

📷 EXIF Photo Blog

https://github.com/sambecker/exif-photo-blog/assets/169298/4253ea54-558a-4358-8834-89943cfbafb4

Deploy with Vercel

Demo App

https://photos.sambecker.com

Features

  • Photo upload with EXIF extraction
  • Organize photos by tag and camera model
  • Infinite scroll
  • Built-in auth
  • Light/dark mode
  • Automatic OG image generation
  • Support for Fujifilm simulations
OG Image Preview

Installation

1. Deploy to Vercel

  1. Click Deploy
  2. Add required storage (Vercel Postgres + Vercel Blob)
  3. Add environment variables
  • NEXT_PUBLIC_SITE_TITLE (e.g., My Photos)
  • NEXT_PUBLIC_SITE_DOMAIN (e.g., photos.domain.com)
  • NEXT_PUBLIC_SITE_DESCRIPTION (optional—mainly used for OG meta)

2. Setup Auth

  1. Generate auth secret
  2. Add to environment variables:
  • AUTH_SECRET
  1. Add admin user to environment variables:
  • ADMIN_EMAIL
  • ADMIN_PASSWORD

3. Upload your first photo

  1. Visit /admin
  2. Click "Choose File"
  3. Title your photo
  4. Click "Create"

4. Develop locally

  1. Clone code
  2. Run pnpm i to install dependencies
  3. Set environment variable AUTH_URL locally (not in production) to http://localhost:3000/api/url (this is a temporary limitation of next-auth v5.0)
  4. Run vc dev to start dev server, and utilize Vercel-stored environment variables

5. Add Analytics (optional)

  1. Open project on Vercel
  2. Click "Analytics" tab
  3. Follow "Enable Web Analytics" instructions (@vercel/analytics is already part of your project)

6. Optional configuration

  • NEXT_PUBLIC_PRO_MODE = 1 enables higher quality image storage
  • NEXT_PUBLIC_GEO_PRIVACY = 1 disables collection/display of location-based data
  • NEXT_PUBLIC_IGNORE_PRIORITY_ORDER = 1 prevents priority_order field affecting photo order
  • NEXT_PUBLIC_PUBLIC_API = 1 enables public API available at /api
  • NEXT_PUBLIC_HIDE_REPO_LINK = 1 removes footer link to repo
  • NEXT_PUBLIC_HIDE_FILM_SIMULATIONS = 1 prevents Fujifilm simulations showing up in /grid sidebar
  • NEXT_PUBLIC_GRID_ASPECT_RATIO = 1.5 sets aspect ratio for grid tiles (defaults to 1—setting to 0 removes the constraint)
  • NEXT_PUBLIC_OG_TEXT_ALIGNMENT = BOTTOM keeps OG image text bottom aligned (default is top)

Setup alternate storage

AWS S3

  1. Setup bucket
    • Create S3 bucket with "ACLs enabled," and "Block all public access" turned off
    • Setup CORS under bucket permissions:
      [{
       "AllowedHeaders": ["*"],
       "AllowedMethods": [
         "GET",
         "PUT"
       ],
       "AllowedOrigins": [
         "http://localhost:*",
         "https://{VERCEL_PROJECT_NAME}*.vercel.app",
         "{PRODUCTION_DOMAIN}"
       ],
       "ExposeHeaders": []
      }]
      
    • Store configuration
      • NEXT_PUBLIC_AWS_S3_BUCKET: bucket name
      • NEXT_PUBLIC_AWS_S3_REGION: bucket region, e.g., "us-east-1"
  2. Setup credentials
    • Create IAM policy using JSON editor:
      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": [
              "s3:PutObject",
              "s3:PutObjectACL",
              "s3:GetObject",
              "s3:ListBucket",
              "s3:DeleteObject"
            ],
            "Resource": [
              "arn:aws:s3:::{BUCKET_NAME}",
              "arn:aws:s3:::{BUCKET_NAME}/*"
            ]
          }
        ]
      }
      
    • Create IAM user by choosing "Attach policies directly," and selecting the policy created above. Create "Access key" under "Security credentials," choose "Application running outside AWS," and store credentials (⚠️ Ensure access keys are not prefixed with NEXT_PUBLIC):
      • AWS_S3_ACCESS_KEY
      • AWS_S3_SECRET_ACCESS_KEY

FAQ

Why are my thumbnails square?

Absent configuration, the default grid aspect ratio is 1. It can be set to any number (for instance 1.5 for 3:2 images) via NEXT_PUBLIC_GRID_ASPECT_RATIO or ignored entirely by setting to 0.

My images/content have fallen out of sync with my database and/or my production site no longer matches local development. What do I do?

Navigate to /admin/configuration and click "Clear Cache."

I'm seeing server-side runtime errors when loading a page after updating my fork. What do I do?

Navigate to /admin/configuration and click "Clear Cache." If this doesn't help, open an issue.

Why aren't my Fujifilm simulations importing alongside EXIF data?

Fujifilm simulation data is stored in vendor-specific Makernote binaries embedded in EXIF data. Under certain circumstances an intermediary may strip out this data for a variety of reasons. For instance, there is a known issue on iOS where editing an image, e.g., cropping it, causes Makernote data loss. If your simulation data appears to be missing, try importing the original file as it was stored by the camera. Additionally, if you can confirm the simulation mode on camera, you can then edit the photo record and manually select it.

Why do my images appear flipped/rotated incorrectly?

For a number of reasons, only EXIF orientations: 1, 3, 6, and 8 are supported. Orientations 2, 4, 5, and 7—which make use of mirroring—are not supported.