No description
Find a file
DJP bbcca20513 Add MSAL authentication to Alt Text Generator
- Integrated Microsoft Authentication Library (MSAL) for secure login
- Protected content is now hidden until successful authentication
- Added login/logout functionality with proper state management
- Updated client ID and redirect URI for production deployment
- Authentication buttons positioned on left side of interface
- Session storage maintains authentication state across page reloads

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 15:52:34 -04:00
.DS_Store Initial commit: Alt Text Generator application 2025-09-16 20:23:28 -04:00
alt_text.svg Initial commit: Alt Text Generator application 2025-09-16 20:23:28 -04:00
config.php Initial commit: Alt Text Generator application 2025-09-16 20:23:28 -04:00
favicon.ico Initial commit: Alt Text Generator application 2025-09-16 20:23:28 -04:00
index.php Add MSAL authentication to Alt Text Generator 2025-09-18 15:52:34 -04:00
README.md Initial commit: Alt Text Generator application 2025-09-16 20:23:28 -04:00

Alt Text Generator

A PHP web application that generates accessible alternative text for images using OpenAI's GPT-4 Vision API. This tool helps create both short and long alt text descriptions that comply with accessibility guidelines.

Features

  • Bulk Image Processing: Upload and process multiple images simultaneously
  • Dual Alt Text Generation: Creates both short (150 characters) and long (400 characters) alt text versions
  • OpenAI Integration: Uses GPT-4 Vision API for intelligent image analysis
  • Export Options: Download results as CSV or individual text files
  • Real-time Processing: Live status updates as images are processed
  • Responsive Design: Works on desktop and mobile devices

Requirements

  • PHP 7.4 or higher
  • Web server (Apache/Nginx)
  • OpenAI API key
  • Internet connection for API calls

Installation

  1. Clone or download this repository to your web server directory
  2. Copy config.php and add your OpenAI API key:
    return [
        'openai_key' => 'your-openai-api-key-here',
        'openai_model' => 'gpt-4o',
        'system_prompt' => '...' // Pre-configured for accessibility
    ];
    
  3. Ensure the following directories are writable:
    • uploads/ - for temporary image storage
    • logs/ - for API response logging

Usage

  1. Open the application in your web browser
  2. Click "Upload Images" to select one or more image files (PNG, JPG, JPEG)
  3. Images will be processed automatically and display:
    • Processing status for each image
    • Short alt text (≤150 characters)
    • Long alt text (≤400 characters)
  4. Once processing is complete, you can:
    • Download all results as a CSV file
    • Download individual text files for each image

Configuration

The application can be customized via config.php:

  • openai_key: Your OpenAI API key
  • openai_model: AI model to use (default: gpt-4o)
  • system_prompt: Instructions for the AI on how to generate alt text

Alt Text Guidelines

The application follows Microsoft's accessibility guidelines:

  • Avoids redundant phrases like "image of" or "picture of"
  • Focuses on the most important elements
  • Includes overlayed text when present
  • Provides factual, non-subjective descriptions
  • Optimized for screen reader technology

File Structure

alt-text-generator/
├── index.php          # Main application file
├── config.php         # Configuration settings
├── alt_text.svg      # Application logo
├── favicon.ico       # Site favicon
├── uploads/          # Temporary image storage
└── logs/             # API response logs

Security Notes

  • Images are temporarily stored in the uploads/ directory
  • API responses are logged for debugging purposes
  • Ensure proper file permissions on directories
  • Keep your OpenAI API key secure

Troubleshooting

  • Check logs/openai_responses.log for API errors
  • Ensure your OpenAI API key has sufficient credits
  • Verify file upload permissions on the uploads/ directory
  • Check PHP error logs for server-side issues

License

This project is provided as-is for educational and business use.