# Presence's Outfits Gizmo: the plan

outfits.lol — "i liek skirts, they go twirl."

A personal CRUD app, forked from the irev.net portfolio code. Scratching
Presence's own itch: not a product, not for anybody else. If someone wants it,
it's on GitHub and backing out Presence's preferences is their problem.

## What it is

- **Items**: every skirt, top, boot, and accessory (in the code these are still
  `samples`). Photos, categories, subcategories, and tags like
  "wedding appropriate", "beach appropriate", or "bring along to change into
  for lunch after the mermaid photoshoot".
- **Outfits**: a set of items packaged together, like the talent agency
  "shopping cart" that was supposed to bundle a couple mermaids, a DJ, and a
  band into one booking. Here it's a top + a skirt + a boot or two = "I really
  wanna wear this tomorrow".
- **History**: outfits I've planned and worn, so I can find my cool combos again.
- **Karma**: a list of likes ("i liek purple and black", "denim skirt with this
  logo t-shirt"), weighted and summed iFetch-style, to make pseudo-decisions
  when I can't make up my mind.

## Who sees what

- **Logged-in Presence**: the homepage is a grid of outfit suggestions for right
  now, like the irev.net homepage grid. Click in, browse tags and
  subcategories ("oh snap, I forgot about those boots"), add items to the
  outfit being built, and save it as tomorrow's plan.
- **Not logged in**: recent outfits and whatever items or categories I mark as
  published, because the stuff's cool (even if it's Temu and thrift store).

## Ground rules

- **Fork, don't merge.** irev.net stays its own thing.
- **Keep table names and function names the same as irev.net** (`samples`,
  `categories`, `tags`, `SaveFile()`, ...). Rename only words people see
  ("Sample" → "Item"). That keeps diffs small, so good improvements can be
  **backported to irev.net** with `git cherry-pick`.
- Same CSS look and purple color scheme as irev.net (Cowkitty's work).
- **The admin gets rebuilt to be responsive**: kill the tables, CSS layout,
  usable on an iPhone.
- Old code keeps its old style. New code follows CLAUDE.md (long names,
  `<?php`, prepared statements).

## Phases

Each phase should be done, usable, and committed before starting the next.

### Phase 0: Fork and stand it up
- Clone irevnet into `~/outfits.lol`. Rename the `origin` remote to
  `irevnet` (for backports) and add a new GitHub repo as `origin`.
- New MariaDB database `outfits`, loaded from `schema.sql` with no rows.
  Make a new admin user.
- New `db.php` (untracked, never committed).
- DNS for `outfits.lol` (and `www.outfits.lol`) pointed at irev.
- Apache vhost `outfits.lol` plus a Let's Encrypt cert.
- Done when: the empty site loads and admin login works.

### Phase 1: Rebrand
- Swap the hardcoded "iRev.net" / "Paul Gorman" / portfolio wording in
  `header.php`, `shared.php`, and `admin.php` for Outfits wording. Keep the CSS.
- Starter categories: Tops, Skirts, Pants, Dresses, Shoes and Boots,
  Accessories, Storage (unpublished: out-of-season bin).

### Phase 2: Photo intake fixes (backport candidate)
- Rotate uploaded photos by their EXIF Orientation in `SaveFile()` /
  `ResizeImage()`, so phone photos stop landing sideways.
- Accept iPhone photos (HEIC → JPEG) if ImageMagick on irev can do it.

### Phase 3: Responsive admin (backport candidate)
- Replace admin HTML tables with CSS (flex/grid), mobile first.
- Item list, item edit, upload, categories, tags: all thumb-friendly.
- Also on irev.net's own wishlist, so this is a big backport.

### Phase 4: Outfit builder ("the shopping cart")
- New tables: `outfits` (name, notes, planned_date, published) and
  `outfititems` (outfit id, item id). Outfits get tags too.
- An "Add to outfit" button on item pages; the outfit being built lives in
  the session, like a cart.
- Save the outfit: name it, give it a date ("tomorrow"), add notes.
- An outfit page showing all its items, plus an outfit history list.

### Phase 5: Homepage grid
- Logged in: a grid of outfit suggestions (at first just recent and random
  saved outfits; karma comes in Phase 6).
- Logged out: recent published outfits and published items.

### Phase 6: Karma (the iFetch part)
- New table `likes`: tag A, tag B, weight (+5 "purple and black", -3 "brown and
  black"), plus item-to-item likes ("this denim skirt with this logo tee").
- Score candidate combos by summing the karma, highest first.
- Suggestions on the homepage come from this.

### Phase 7: Worn log and closethits
- "Wore it today" button on an outfit. Each wear bumps the karma for that
  outfit's tag pairs.
- `closethits` / `RecordHit()` logging so the MariaDB qps graph has a 7:15 am
  spike.
- Stats: most worn, never worn, "the $6 purple skirt has been worn 14 times".

### Phase 8: CLIP auto-guess on upload
- The laundry-basket workflow: snap and upload a pile of photos from the admin
  while putting clean laundry away. The upload just saves the files and
  returns right away, with no waiting on a spinner.
- A cron job (`classify.php`, every few minutes) picks up items not yet
  classified, loads CLIP once, and fills in suggested type, color, pattern, and
  condition tags.
- Later, the admin shows a "fresh from the laundry" list of newly classified
  items to review: fix the tags, name it, pick categories.
- Later: clothes-segmentation to split outfit photos and cut out backgrounds,
  then the paper-doll mannequin.

## Backport log

When something here turns out to be a real improvement, note it below and
cherry-pick it into irev.net.

- (nothing yet)
