moritz-sauer-13/silverstripe-ai-alt-text
Composer 安装命令:
composer require moritz-sauer-13/silverstripe-ai-alt-text
包简介
Generate alt text for images via OpenAI Api
README 文档
README
Generates alt texts for images via OpenAI Vision API. Integrates seamlessly into the SilverStripe 6 CMS AssetAdmin — a native FormAction button triggers AI-based generation and saves the result directly.
Requires purplespider/asset-alt-text for the AltText field on Image assets.
Requirements
- SilverStripe Framework ^6
- purplespider/asset-alt-text ^3
- openai-php/client ^0.18.0
- PHP 8.1+
Installation
composer require moritz-sauer-13/silverstripe-ai-alt-text
Then run:
vendor/bin/sake dev/build flush=1
Configuration
API Key (required)
Set the OpenAI API key via environment variable (recommended) or YAML config.
Option 1: Environment variable (.env file or server config)
OPENAI_API_KEY="sk-your-api-key-here"
Option 2: YAML config (app/_config/ai-alt-text.yml)
AiAltText\Service\OpenAiVisionClient: api_key: 'sk-your-api-key-here'
Note: Environment variables take precedence over YAML config.
Optional Configuration
# Model selection (default: gpt-4o-mini) AiAltText\Service\OpenAiVisionClient: model: 'gpt-4o' max_tokens: 300 # Image resize limits before sending to OpenAI (default: 1024x1024) AiAltText\Service\AltTextGenerator: max_image_width: 1024 max_image_height: 1024
Custom Prompt (SiteConfig)
The AI prompt can be customized directly in the CMS:
- Go to Settings in the CMS
- Click on the AI Alt Text tab
- Enter your custom prompt in the text field
- Save
The custom prompt allows you to:
- Set the output language directly (e.g., "Write in German" or "Schreibe auf Deutsch")
- Customize the style and length of generated alt texts
- Add specific instructions for your content type
Example custom prompt (German):
Schreibe einen prägnanten, beschreibenden Alt-Text für dieses Bild auf Deutsch.
Regeln:
- Länge: 80-160 Zeichen, kürzer bei einfachen Bildern.
- Sei spezifisch und beschreibend.
- Beginne nicht mit "Bild von", "Foto von" oder ähnlichen Phrasen.
- Keine Marketing-Sprache.
- Gib NUR den Alt-Text zurück, nichts anderes.
Leave the field empty to use the default English prompt.
License
BSD-3-Clause
moritz-sauer-13/silverstripe-ai-alt-text 适用场景与选型建议
moritz-sauer-13/silverstripe-ai-alt-text 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silverstripe」 「icon」 「image analysis」 「alt text」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moritz-sauer-13/silverstripe-ai-alt-text 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moritz-sauer-13/silverstripe-ai-alt-text 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moritz-sauer-13/silverstripe-ai-alt-text 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Library to get the apple-touch-icons and favicon from a website.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Icon support for Silverstripe taxonomy terms
Analytics chooser extensions for site settings.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2026-02-09