MyPhotoAI · pSEO case study

Image pipeline

Per-slug imagery is one of the strongest pSEO signals. A site whose pages all share a single hero image looks templated to a reader and to a crawler; a site whose pages each carry a distinct, on-topic image looks like real editorial work. The hard part is doing this at the cost of zero.

Generation

The default provider is Pollinations.ai. It is free, rate-limited to roughly one request per 15 seconds, and returns images suitable for use after a sharp pass for compression and metadata stripping. The script supports a --paid flag that switches to Replicate's FLUX model for higher fidelity, but the case-study site itself runs on the free tier.

Each slug declares an imagePrompt. A style suffix is appended uniformly across slugs so the visual language stays consistent ("technical diagram, minimal, eggshell paper background, Vellum & Stars palette" or similar). The generator:

  1. HEAD-checks the target CDN URL. If it returns 200, the slug is skipped. This makes the script safely re-runnable.
  2. Otherwise, POSTs the prompt to the provider with a 120-second timeout.
  3. Runs the response through sharp: convert to WEBP, quality 85, strip EXIF.
  4. Writes the file to a local staging directory.

After the loop, every newly-written file is rsynced to the CDN host. Failures during generation are collected, logged, and reported at the end; the script does not abort mid-loop.

Cost containment

The unit cost matters because the manifest grows. Three rules keep it bounded.

  1. Idempotent by filename. Re-running the script costs nothing if no slugs were added.
  2. Free tier first. The default provider is free and acceptable for pSEO surfaces where the image is supporting, not the headline.
  3. Cache forever at the edge. The CDN serves images with Cache-Control: public, immutable and a 30-day expires. Filenames embed the slug, so a regenerated image needs a deliberate cache bust.

Delivery

The CDN is a separate nginx vhost on the same VPS, rooted at /var/www/images.alkenacode.dev. Path pattern is /<top-level>/<slug>/<slug>-<n>.webp. Different AlkenaCode properties claim different top-level paths (/pseo/ for this case study, /agents/ for the agents site). One CDN, many consumers, zero coupling.

What this is not

This pipeline is not an image-generation product. It is the support infrastructure for the editorial work. The case study at myphotoai.io is the product where on-demand image generation IS the product; this site documents how that product's pSEO surface was built, not how its image generation works for end users.

See the architecture page for how the image-generation script slots into the broader system, and the results page for what the per-slug imagery did to engagement metrics.