![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/-5896b3ba/ |
<?php
// Create Beautiful Open Graph Image for Facebook Sharing
// This script generates a branded OG image with your logo and messaging
// Set content type to image
header('Content-Type: image/png');
// Check if GD library is available
if (!extension_loaded('gd')) {
// Redirect to simple version if GD not available
header('Location: /create_simple_image.php');
exit;
}
// Create image canvas (Facebook recommends 1200x630)
$width = 1200;
$height = 630;
$image = imagecreatetruecolor($width, $height);
// Define colors (your brand colors)
$bgColor = imagecolorallocate($image, 10, 10, 10); // Dark background
$primaryColor = imagecolorallocate($image, 102, 126, 234); // Your blue
$secondaryColor = imagecolorallocate($image, 118, 75, 162); // Your purple
$accentColor = imagecolorallocate($image, 255, 255, 255); // White
$textColor = imagecolorallocate($image, 255, 255, 255); // White text
$subtitleColor = imagecolorallocate($image, 200, 200, 200); // Light gray
// Fill background with gradient effect
for ($y = 0; $y < $height; $y++) {
$ratio = $y / $height;
$r = 10 + ($ratio * 20);
$g = 10 + ($ratio * 25);
$b = 10 + ($ratio * 30);
$color = imagecolorallocate($image, $r, $g, $b);
imageline($image, 0, $y, $width, $y, $color);
}
// Add subtle geometric patterns
for ($i = 0; $i < 50; $i++) {
$x = rand(0, $width);
$y = rand(0, $height);
$size = rand(2, 8);
$alpha = rand(20, 60);
$color = imagecolorallocatealpha($image, 102, 126, 234, $alpha);
imagefilledellipse($image, $x, $y, $size, $size, $color);
}
// Add main logo area (circular)
$logoCenterX = $width / 2;
$logoCenterY = $height / 2 - 80;
$logoRadius = 120;
// Logo background with gradient
for ($r = $logoRadius; $r >= 0; $r--) {
$ratio = $r / $logoRadius;
$r1 = 102 + ($ratio * 20);
$g1 = 126 + ($ratio * 30);
$b1 = 234 + ($ratio * 40);
$color = imagecolorallocate($image, $r1, $g1, $b1);
imagefilledellipse($image, $logoCenterX, $logoCenterY, $r * 2, $r * 2, $color);
}
// Add logo icon (musical note)
$noteColor = imagecolorallocate($image, 255, 255, 255);
$noteSize = 80;
$noteX = $logoCenterX - $noteSize / 2;
$noteY = $logoCenterY - $noteSize / 2;
// Draw musical note (simplified)
imagefilledellipse($image, $noteX + 20, $noteY + 40, 25, 25, $noteColor); // Note head
imagefilledrectangle($image, $noteX + 32, $noteY + 15, 8, 50, $noteColor); // Stem
imagefilledellipse($image, $noteX + 35, $noteY + 15, 15, 15, $noteColor); // Flag
// Add brand name
$fontSize = 72;
$fontPath = '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'; // Common font path
if (!file_exists($fontPath)) {
$fontPath = '/System/Library/Fonts/Arial.ttf'; // macOS fallback
}
if (!file_exists($fontPath)) {
$fontPath = 'arial.ttf'; // Windows fallback
}
// Main title
$title = "SoundStudioPro";
if (function_exists('imagettfbbox') && file_exists($fontPath)) {
$titleBox = imagettfbbox($fontSize, 0, $fontPath, $title);
$titleWidth = $titleBox[4] - $titleBox[0];
$titleX = ($width - $titleWidth) / 2;
} else {
// Fallback positioning for basic text
$titleX = ($width - strlen($title) * 20) / 2;
}
$titleY = $logoCenterY + 200;
// Add title with shadow effect
$shadowColor = imagecolorallocate($image, 0, 0, 0);
// Try TTF text first, fallback to basic text
if (function_exists('imagettftext') && file_exists($fontPath)) {
imagettftext($image, $fontSize, 0, $titleX + 3, $titleY + 3, $shadowColor, $fontPath, $title);
imagettftext($image, $fontSize, 0, $titleX, $titleY, $textColor, $fontPath, $title);
} else {
// Fallback to basic text
imagestring($image, 5, $titleX + 3, $titleY + 3, $title, $shadowColor);
imagestring($image, 5, $titleX, $titleY, $title, $textColor);
}
// Subtitle
$subtitleSize = 36;
$subtitle = "AI Music Creation Platform";
$subtitleBox = imagettfbbox($subtitleSize, 0, $fontPath, $subtitle);
$subtitleWidth = $subtitleBox[4] - $subtitleBox[0];
$subtitleX = ($width - $subtitleWidth) / 2;
$subtitleY = $titleY + 60;
// Try TTF text first, fallback to basic text
if (function_exists('imagettftext') && file_exists($fontPath)) {
imagettftext($image, $subtitleSize, 0, $subtitleX, $subtitleY, $subtitleColor, $fontPath, $subtitle);
} else {
// Fallback to basic text
imagestring($image, 4, $subtitleX, $subtitleY, $subtitle, $subtitleColor);
}
// Tagline
$taglineSize = 28;
$tagline = "Create Professional Music with AI";
if (function_exists('imagettfbbox') && file_exists($fontPath)) {
$taglineBox = imagettfbbox($taglineSize, 0, $fontPath, $tagline);
$taglineWidth = $taglineBox[4] - $taglineBox[0];
$taglineX = ($width - $taglineWidth) / 2;
} else {
// Fallback positioning for basic text
$taglineX = ($width - strlen($tagline) * 12) / 2;
}
$taglineY = $subtitleY + 50;
if (function_exists('imagettftext') && file_exists($fontPath)) {
imagettftext($image, $taglineSize, 0, $taglineX, $taglineY, $accentColor, $fontPath, $tagline);
} else {
// Fallback to basic text
imagestring($image, 3, $taglineX, $taglineY, $tagline, $accentColor);
}
// Add decorative elements
$decorColor = imagecolorallocate($image, 118, 75, 162);
for ($i = 0; $i < 3; $i++) {
$x = 100 + ($i * 400);
$y = $height - 100;
$size = 15;
imagefilledellipse($image, $x, $y, $size, $size, $decorColor);
}
// Add bottom accent line
$lineY = $height - 60;
$lineColor = imagecolorallocate($image, 102, 126, 234);
imagefilledrectangle($image, 0, $lineY, $width, $lineY + 4, $lineColor);
// Output the image
imagepng($image);
imagedestroy($image);
?>