- Fixed main config.php file paths to match actual API directory structure - Fixed duplicate constant definitions by removing redundant includes - Added image_url POST handling to OpenAI image edit tool - Enhanced OpenAI process_edit.php to handle received images from main page - Created missing download-edit.php for file downloads - Fixed "Send to Edit" button functionality for all AI tools - Updated edit screens to properly receive and process images - All 11 AI tools properly configured and working 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
108 lines
3.3 KiB
PHP
Executable file
108 lines
3.3 KiB
PHP
Executable file
<?php
|
|
require_once 'apis/sd3/config.php';
|
|
require_once 'apis/bria/config.php';
|
|
require_once 'apis/leonardo/config.php';
|
|
require_once 'apis/leonardo/config_character.php';
|
|
require_once 'apis/leonardo/config_style.php';
|
|
require_once 'apis/ideogram/config.php';
|
|
require_once 'apis/dalle3/config.php';
|
|
require_once 'apis/flux/config.php';
|
|
require_once 'apis/openai/config.php';
|
|
require_once 'apis/firefly/config.php';
|
|
require_once 'apis/nano_banana/config.php';
|
|
|
|
$aiTools = [
|
|
'Stable Diffusion' => ['Stable Diffusion 3'],
|
|
'Bria' => ['Bria 2.3 Base', 'Bria 2.3 Fast'],
|
|
'Leonardo' => ['Leonardo AI'],
|
|
'Leonardo-Style' => ['Leonardo Style'],
|
|
'Leonardo-Character' => ['Leonardo Character'],
|
|
'Ideogram' => ['Ideogram AI'],
|
|
'Flux' => ['Flux Pro 1.1'],
|
|
'DALL-E 3' => ['DALL-E 3'],
|
|
'OpenAI-Image' => ['GPT-Image-1'],
|
|
'Firefly' => ['Adobe Firefly v3'],
|
|
'Nano Banana' => ['Google Gemini 2.5 Flash Image']
|
|
];
|
|
|
|
$aiOptions = [
|
|
'Stable Diffusion' => $sd3Options,
|
|
'Bria' => $briaOptions,
|
|
'Leonardo' => $leonardoOptions,
|
|
'Leonardo-Style' => $leonardoStyleOptions,
|
|
'Leonardo-Character' => $leonardoCharacterOptions,
|
|
'DALL-E 3' => $dalle3Options,
|
|
'Ideogram' => $ideogramOptions,
|
|
'Flux' => $fluxOptions,
|
|
'OpenAI-Image' => $openaiImageOptions,
|
|
'Firefly' => $fireflyOptions,
|
|
'Nano Banana' => $nanoBananaOptions
|
|
];
|
|
|
|
// General configuration settings
|
|
define('SITE_NAME', 'AI Image Generator');
|
|
define('SITE_URL', 'http://yourdomain.com'); // Replace with your actual domain
|
|
|
|
// File upload settings
|
|
define('UPLOAD_DIR', __DIR__ . '/uploads/');
|
|
define('MAX_FILE_SIZE', 10 * 1024 * 1024); // 10 MB
|
|
|
|
// API rate limiting (if needed)
|
|
define('API_RATE_LIMIT', 60); // Number of requests per minute
|
|
|
|
// Error reporting settings
|
|
ini_set('display_errors', 0);
|
|
ini_set('log_errors', 1);
|
|
ini_set('error_log', __DIR__ . '/logs/error.log');
|
|
|
|
// Time zone setting
|
|
date_default_timezone_set('UTC');
|
|
|
|
// Session configuration (if you plan to use sessions)
|
|
ini_set('session.cookie_httponly', 1);
|
|
ini_set('session.use_only_cookies', 1);
|
|
ini_set('session.cookie_secure', 1);
|
|
|
|
// Function to sanitize user inputs
|
|
function sanitize_input($input) {
|
|
return htmlspecialchars(strip_tags(trim($input)));
|
|
}
|
|
|
|
// Function to log errors
|
|
function logError($message) {
|
|
error_log(date('[Y-m-d H:i:s] ') . $message . "\n", 3, __DIR__ . '/logs/error.log');
|
|
}
|
|
|
|
// Function to validate file upload
|
|
function validateFileUpload($file) {
|
|
$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif'];
|
|
$maxFileSize = MAX_FILE_SIZE;
|
|
|
|
$fileExtension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
|
|
|
|
if (!in_array($fileExtension, $allowedExtensions)) {
|
|
return "Invalid file type. Allowed types: " . implode(', ', $allowedExtensions);
|
|
}
|
|
|
|
if ($file['size'] > $maxFileSize) {
|
|
return "File is too large. Maximum size allowed: " . ($maxFileSize / 1024 / 1024) . "MB";
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// Function to generate a unique filename
|
|
function generateUniqueFilename($originalFilename) {
|
|
$extension = pathinfo($originalFilename, PATHINFO_EXTENSION);
|
|
return uniqid() . '.' . $extension;
|
|
}
|
|
|
|
// Function to move uploaded file
|
|
function moveUploadedFile($file, $destination) {
|
|
if (move_uploaded_file($file['tmp_name'], $destination)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// You can add more configuration settings and utility functions as needed
|