[ "https://images.unsplash.com/photo-1503676260728-1c00da094a0b?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1427504494785-3a9ca7044f45?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1488521787991-ed7bbaae773c?auto=format&fit=crop&w=800&q=80" ], 'ration' => [ "https://images.unsplash.com/photo-1593113515093-61ba4f7f4577?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1532629345422-7515f3d16bb6?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1618666012174-83b441c0bc76?auto=format&fit=crop&w=800&q=80" ], 'medical' => [ "https://images.unsplash.com/photo-1576091160550-2173dba999ef?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1584515933487-779824d29309?auto=format&fit=crop&w=800&q=80" ], 'animals' => [ "https://images.unsplash.com/photo-1548842188-f5424dfc0df8?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1599839619722-39751411ea63?auto=format&fit=crop&w=800&q=80" ], 'generic' => [ "https://images.unsplash.com/photo-1469571486292-0ba58a3f068b?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1559027615-cd4628902d4a?auto=format&fit=crop&w=800&q=80", "https://images.unsplash.com/photo-1594708767771-a7502209ff51?auto=format&fit=crop&w=800&q=80" ] ]; // Premium Themes $themes = [ ['id' => 'maroon-gold', 'bg' => 'bg-gradient-to-br from-red-950 via-rose-900 to-[#4A0E17]', 'border' => 'border-yellow-500/30', 'accent' => 'text-yellow-400', 'isLight' => false], ['id' => 'divine-orange', 'bg' => 'bg-gradient-to-tr from-[#2b0303] via-red-800 to-orange-600', 'border' => 'border-orange-400/40', 'accent' => 'text-orange-300', 'isLight' => false], ['id' => 'royal-purple', 'bg' => 'bg-gradient-to-bl from-purple-950 via-fuchsia-900 to-rose-950', 'border' => 'border-pink-500/30', 'accent' => 'text-pink-300', 'isLight' => false], ['id' => 'hope-emerald', 'bg' => 'bg-gradient-to-br from-emerald-950 via-teal-900 to-[#022c22]', 'border' => 'border-emerald-400/30', 'accent' => 'text-emerald-300', 'isLight' => false], ['id' => 'classic-india', 'bg' => 'bg-gradient-to-b from-orange-100 via-white to-orange-50', 'border' => 'border-red-600/40', 'accent' => 'text-red-700', 'isLight' => true], ['id' => 'luxury-dark', 'bg' => 'bg-[#0a0a0a]', 'border' => 'border-yellow-600/50', 'accent' => 'text-yellow-500', 'isLight' => false] ]; // Helper to analyze text and pick a category function analyzeCategory($text) { $lower = mb_strtolower($text, 'UTF-8'); if (strpos($lower, 'बच्च') !== false || strpos($lower, 'education') !== false || strpos($lower, 'शिक्षा') !== false || strpos($lower, 'book') !== false) return 'education'; if (strpos($lower, 'राशन') !== false || strpos($lower, 'भोजन') !== false || strpos($lower, 'food') !== false || strpos($lower, 'kit') !== false || strpos($lower, 'महिला') !== false) return 'ration'; if (strpos($lower, 'health') !== false || strpos($lower, 'medical') !== false || strpos($lower, 'चिकित्सा') !== false || strpos($lower, 'camp') !== false) return 'medical'; if (strpos($lower, 'गौ') !== false || strpos($lower, 'जीव') !== false || strpos($lower, 'animal') !== false || strpos($lower, 'cow') !== false) return 'animals'; return 'generic'; } function getRandomImage($arr) { return $arr[array_rand($arr)]; } // Inline SVG Icon Helper (Lucide equivalents) function getIcon($name, $classes = '') { $svgs = [ 'heart' => '', 'sparkles' => '', 'phone' => '', 'globe' => '', 'users' => '', 'book' => '', 'package' => '', 'bird' => '', 'stethoscope' => '', 'info' => '', 'qrcode' => '', 'layout' => '', 'image' => '', 'download' => '', 'zap' => '', 'trash2' => '', 'plus' => '' ]; return isset($svgs[$name]) ? $svgs[$name] : ''; } function getCategoryIcon($category) { switch($category) { case 'education': return getIcon('book', 'text-blue-500 w-full h-full'); case 'ration': return getIcon('package', 'text-orange-500 w-full h-full'); case 'medical': return getIcon('stethoscope', 'text-red-500 w-full h-full'); case 'animals': return getIcon('bird', 'text-green-500 w-full h-full'); default: return getIcon('heart', 'text-pink-500 w-full h-full'); } } // Initial Form State $formData = [ 'ngoName' => "Shree Kutch Mahila Vikas", 'headline' => "सेवा ही सर्वोत्तम धर्म", 'mobile' => "+91 9173516693", 'upi' => "pdp.apexautolink-2@oksbi", 'tagline' => "एक कदम सेवा की ओर", 'trustMessage' => "आपका छोटा सा सहयोग किसी की जिंदगी बदल सकता है", 'website' => "www.example.org", 'services' => [ "गरीब बच्चों को बैग व नोटबुक", "महिलाओं को राशन किट", "Health and Medical Camp", "गौ सेवा व जीवदया कार्य" ] ]; // Process POST request if ($_SERVER['REQUEST_METHOD'] === 'POST') { $formData['ngoName'] = $_POST['ngoName'] ?? ''; $formData['headline'] = $_POST['headline'] ?? ''; $formData['mobile'] = $_POST['mobile'] ?? ''; $formData['upi'] = $_POST['upi'] ?? ''; $formData['tagline'] = $_POST['tagline'] ?? ''; $formData['trustMessage'] = $_POST['trustMessage'] ?? ''; $formData['website'] = $_POST['website'] ?? ''; $formData['services'] = $_POST['services'] ?? []; // Filter empty services $formData['services'] = array_filter($formData['services'], function($v) { return trim($v) !== ''; }); if(count($formData['services']) > 5) { $formData['services'] = array_slice($formData['services'], 0, 5); } } // Generate Posters Configuration $posters = []; $numVariations = 6; $timestamp = time(); for ($i = 0; $i < $numVariations; $i++) { $layout = $i % 6; // Determine Theme if ($layout === 3) { $theme = $themes[4]; // 'classic-india' } else if ($layout === 4) { $theme = $themes[5]; // 'luxury-dark' } else { $theme = $themes[$i % (count($themes) - 2)]; } // AI Simulation: Resolve images based on text $generatedImages = []; foreach ($formData['services'] as $service) { $category = analyzeCategory($service); $generatedImages[] = getRandomImage($imagePools[$category]); } // Extra hero image $generatedImages['hero'] = getRandomImage($imagePools['generic']); $posters[] = [ 'id' => "var-{$timestamp}-{$i}", 'theme' => $theme, 'layout' => $layout, 'generatedImages' => $generatedImages ]; } // The core render engine for individual posters function renderPosterTemplate($data, $config) { $theme = $config['theme']; $layout = $config['layout']; $generatedImages = $config['generatedImages']; $textColor = $theme['isLight'] ? 'text-gray-900' : 'text-white'; $subTextColor = $theme['isLight'] ? 'text-gray-700' : 'text-gray-200'; $isLight = $theme['isLight']; // Component Render Functions $renderHeader = function($customClass = "") use ($data, $isLight, $textColor) { $badgeClass = $isLight ? 'border-red-500 bg-red-50 text-red-700' : 'glass-panel border-yellow-500/50 text-yellow-300'; $headlineClass = $isLight ? 'text-red-700 drop-shadow-md' : 'text-transparent bg-clip-text bg-gradient-to-b from-white via-yellow-100 to-yellow-500 drop-shadow-[0_5px_15px_rgba(0,0,0,0.8)]'; $lineClass1 = $isLight ? 'bg-red-300' : 'bg-gradient-to-r from-transparent to-white/50'; $lineClass2 = $isLight ? 'bg-red-300' : 'bg-gradient-to-l from-transparent to-white/50'; $sparkleIcon = getIcon('sparkles', 'w-4 h-4 mr-2'); return "
{$sparkleIcon} " . htmlspecialchars($data['tagline']) . "

🙏
" . htmlspecialchars($data['headline']) . "

" . htmlspecialchars($data['ngoName']) . "

"; }; $renderQR = function($isProminent, $customClass = "") use ($data, $isLight) { $qrData = "upi://pay?pa={$data['upi']}&pn=" . urlencode($data['ngoName']) . "&cu=INR"; $qrColor = $isLight ? 'B91C1C' : '4A0E17'; $qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=" . urlencode($qrData) . "&color={$qrColor}"; $containerClass = $isProminent ? ($isLight ? 'bg-white border-4 border-red-600 p-8 rounded-[30px] shadow-2xl' : 'glass-panel-dark border-2 border-yellow-400/50 p-10 rounded-[40px] glow-border') : 'bg-white/95 p-6 rounded-[30px] shadow-xl'; $glowEffect = (!$isLight && $isProminent) ? "
" : ""; return "
{$glowEffect}
— Scan Here To Donate —
QR Code

" . htmlspecialchars($data['upi']) . "

"; }; $renderClassicServiceCard = function($service, $index) use ($generatedImages) { $category = analyzeCategory($service); $icon = getCategoryIcon($category); $imgSrc = $generatedImages[$index] ?? ''; return "
{$icon}

" . htmlspecialchars($service) . "

Service
"; }; $renderModernServices = function($grid = false) use ($data, $isLight, $textColor, $layout, $generatedImages) { $titleClass = $isLight ? 'text-red-700' : 'text-transparent bg-clip-text bg-gradient-to-r from-yellow-200 to-yellow-500'; $heartIcon = getIcon('heart', 'text-red-500 fill-red-500 w-8 h-8'); $containerClass = $grid ? "grid grid-cols-2 gap-6" : "flex flex-col gap-5"; $html = "

{$heartIcon} प्रमुख सेवा कार्य {$heartIcon}

"; foreach ($data['services'] as $index => $service) { $cardBg = $isLight ? 'bg-white border-red-200' : 'glass-panel border-white/20'; $reverseClass = (!$grid && $index % 2 !== 0 && ($layout === 1 || $layout === 4)) ? 'flex-row-reverse text-right' : ''; $marginClass = (!$grid && $index % 2 !== 0 && ($layout === 1 || $layout === 4)) ? 'mr-2' : 'ml-2'; $imgSrc = $generatedImages[$index] ?? ''; $html .= "
Service

" . htmlspecialchars($service) . "

"; } $html .= "
"; return $html; }; $renderHero = function($customClass = "px-10 mb-8 mt-4") use ($generatedImages) { $imgSrc = $generatedImages['hero'] ?? ''; return "
Hero

\"मानव सेवा ही माधव सेवा है\"

"; }; $renderFooterBar = function() use ($isLight) { $bgClass = $isLight ? 'bg-red-800 text-yellow-100' : 'bg-black/80 text-yellow-500'; $h = getIcon('heart', 'w-[18px] h-[18px]'); $u = getIcon('users', 'w-[18px] h-[18px]'); $b = getIcon('book', 'w-[18px] h-[18px]'); $p = getIcon('package', 'w-[18px] h-[18px]'); $bd = getIcon('bird', 'w-[18px] h-[18px]'); return "
{$h} सेवा {$u} महिला सशक्तिकरण {$b} शिक्षा {$p} राशन सहायता {$bd} जीवदया
"; }; $renderFooter = function($withBar = false) use ($data, $isLight, $textColor, $renderFooterBar) { $bgClass = $isLight ? 'bg-red-50/90' : 'bg-black/60'; $borderClass = $isLight ? 'border-red-200' : 'border-yellow-500/30'; $roundedClass = $withBar ? '' : 'rounded-t-[50px]'; $heartIcon = getIcon('heart', 'w-10 h-10 text-red-900 fill-red-900'); $phoneIcon = getIcon('phone', 'w-6 h-6'); $globeIcon = getIcon('globe', 'w-5 h-5'); $websiteHtml = ""; if(!empty($data['website'])) { $webColor = $isLight ? 'text-red-700 bg-white border-red-200' : 'text-yellow-200 bg-white/5 border-white/10'; $websiteHtml = "
{$globeIcon} " . htmlspecialchars($data['website']) . "
"; } $barHtml = $withBar ? $renderFooterBar() : ""; return "
{$heartIcon}

\"" . htmlspecialchars($data['trustMessage']) . "\"

{$phoneIcon} " . htmlspecialchars($data['mobile']) . "
{$websiteHtml}
{$barHtml}
❤ आपका छोटा सा सहयोग, किसी की ज़िंदगी बदल सकता है ❤
"; }; // Build Base HTML $svgPattern = "data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"; $patternOpacity = $isLight ? 'opacity-5' : 'opacity-[0.15]'; $html = "
"; $html .= "
"; $html .= "
"; if (!$isLight) { $html .= "
"; } // Switch Layout Content if ($layout === 0) { // Modern Vertical $html .= "
"; $html .= $renderHeader(); $html .= $renderHero(); $html .= $renderModernServices(); $html .= "
"; $html .= $renderQR(true, "mx-10 my-8"); $html .= $renderFooter(); $html .= "
"; } else if ($layout === 1) { // Centered Elegant $html .= "
"; $html .= $renderHeader(); $html .= $renderQR(false, "mx-32 my-4"); $html .= $renderModernServices(); $html .= "
"; $html .= $renderFooter(); $html .= "
"; } else if ($layout === 2) { // Hero Top Focus $html .= "
"; $html .= $renderHero("px-6 pt-6"); $html .= $renderHeader("pt-4"); $html .= $renderModernServices(true); $html .= "
"; $html .= $renderQR(true, "mx-10 my-6"); $html .= $renderFooter(); $html .= "
"; } else if ($layout === 3) { // Traditional Dense $html .= "
"; $html .= "

🙏 " . htmlspecialchars($data['headline']) . " 🙏

" . $renderQR(true, "w-full") . "
"; foreach ($data['services'] as $i => $s) { $html .= $renderClassicServiceCard($s, $i); } $html .= "
✧ आपका सहयोग हमारा सम्मान ✧

" . htmlspecialchars($data['ngoName']) . "

• " . htmlspecialchars($data['tagline']) . " •
"; $html .= $renderFooter(true); $html .= "
"; } else if ($layout === 4) { // Dark Grid $html .= "
"; $html .= $renderHeader(); $html .= "
"; $html .= "
"; $html .= "
" . $renderQR(true, "w-full") . "
"; $html .= "
"; $services = $data['services']; foreach (array_slice($services, 0, 2) as $index => $service) { $catIcon = getCategoryIcon(analyzeCategory($service)); $html .= "
{$catIcon}

" . htmlspecialchars($service) . "

"; } $html .= "
"; if (count($services) > 2) { $html .= "
"; foreach (array_slice($services, 2, 2) as $index => $service) { $catIcon = getCategoryIcon(analyzeCategory($service)); $html .= "
{$catIcon}

" . htmlspecialchars($service) . "

"; } $html .= "
"; } $html .= "
"; $html .= $renderFooter(); $html .= "
"; } else if ($layout === 5) { // Side Split Modern $phoneIcon = getIcon('phone', 'w-4 h-4'); $imgSrc = $generatedImages['hero'] ?? ''; $html .= "
"; $html .= "
Hero

🙏 " . htmlspecialchars($data['headline']) . " 🙏

" . htmlspecialchars($data['ngoName']) . "

" . $renderModernServices() . "
" . $renderQR(true, "w-full scale-90") . "
\"" . htmlspecialchars($data['trustMessage']) . "\"
{$phoneIcon} " . htmlspecialchars($data['mobile']) . "
"; $html .= "
"; } $html .= "
"; return $html; } ?> NGO AutoGen - PHP Version

NGO AutoGen

AI Poster Portal - PHP Version

Basic Info

Payment & Contact

Service Campaigns (Max 5)

$service): ?>

Footer Trust Quote

6 Unique AI Layouts

Including Traditional Indian & Modern UI styles (1080x1920 HD)

Designs Ready
$poster) { $htmlContent = renderPosterTemplate($formData, $poster); ?>
Layout :