25 lines
686 B
PHP
Executable File
25 lines
686 B
PHP
Executable File
<?php
|
|
header('Content-Type: application/json');
|
|
|
|
$prompt = $_POST['prompt'] ?? $_GET['prompt'] ?? '';
|
|
if (empty($prompt)) {
|
|
echo json_encode(['error' => 'Prompt required']);
|
|
exit;
|
|
}
|
|
|
|
// Utiliser Pollinations.ai (gratuit, pas de clé)
|
|
$encodedPrompt = urlencode($prompt);
|
|
$imageUrl = "https://image.pollinations.ai/prompt/$encodedPrompt?width=1024&height=1024&nologo=true";
|
|
|
|
// Vérifier que l'image est accessible
|
|
$headers = @get_headers($imageUrl);
|
|
$success = $headers && strpos($headers[0], '200') !== false;
|
|
|
|
echo json_encode([
|
|
'success' => $success,
|
|
'prompt' => $prompt,
|
|
'image_url' => $imageUrl,
|
|
'provider' => 'Pollinations.ai (Free Stable Diffusion)'
|
|
]);
|
|
|