Skip to content

Add image generation API endpoint#148

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/generate-images-feature
Draft

Add image generation API endpoint#148
Copilot wants to merge 4 commits intomasterfrom
copilot/generate-images-feature

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 9, 2025

Adds programmatic placeholder image generation for products and categories.

Changes

  • server/lib/image_generator.cjs - SVG-based image generator using Sharp (existing dep)

    • Customizable dimensions (1-4000px), text, colors, format (JPEG/PNG)
    • Returns API-compatible image paths
  • server/api/routes_image_generator.cjs - POST /api/v1/generate-image endpoint

    • Input validation with error responses
    • Authenticated via existing x-stjorna-userid header
  • server/test/api/image_generator.spec.cjs - 5 tests covering success/error cases

  • Documentation - API usage in server/README.md, feature list in root README.md

Usage

POST /api/v1/generate-image
{
  "width": 400,
  "height": 300,
  "text": "Product Name",
  "backgroundColor": "#3498db",
  "textColor": "#ffffff",
  "format": "png"
}

# Returns: { "imageUrl": "/data/uploads/userid/products/hash.png", ... }

Use cases: placeholder generation during product creation, bulk imports, category thumbnails.

Original prompt

can you generate images?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 9, 2025 11:59
Co-authored-by: matthiasbaldi <12791996+matthiasbaldi@users.noreply.github.com>
Co-authored-by: matthiasbaldi <12791996+matthiasbaldi@users.noreply.github.com>
Co-authored-by: matthiasbaldi <12791996+matthiasbaldi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add image generation feature Add image generation API endpoint Nov 9, 2025
Copilot AI requested a review from matthiasbaldi November 9, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants