![]() 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/-3df8ec43/ |
<?php
/**
* Generate Holiday Gift OG Image for Facebook Sharing
* Creates a festive Open Graph image with SoundStudioPro logo and holiday theme
*/
// Check if GD extension is available
if (!extension_loaded('gd')) {
// Fallback to default OG image
header('Location: /assets/images/og-image.png');
exit;
}
// Set content type to PNG
header('Content-Type: image/png');
header('Cache-Control: public, max-age=86400');
// Create image with optimal OG dimensions (Facebook recommended: 1200x630)
$width = 1200;
$height = 630;
$image = imagecreatetruecolor($width, $height);
// Enable alpha blending
imagealphablending($image, true);
imagesavealpha($image, true);
// Holiday color palette
$holiday_red = [252, 165, 165]; // #fca5a5
$holiday_orange = [251, 146, 60]; // #fb923c
$holiday_yellow = [251, 191, 36]; // #fbbf24
$holiday_green = [52, 211, 153]; // #34d399
$holiday_blue = [96, 165, 250]; // #60a5fa
$bg_dark = [10, 10, 10]; // #0a0a0a
$bg_darker = [26, 26, 26]; // #1a1a1a
// Create dark gradient background with holiday glow
for ($y = 0; $y < $height; $y++) {
for ($x = 0; $x < $width; $x++) {
// Create a subtle gradient from dark to slightly lighter dark
$ratio = $y / $height;
$r = round($bg_dark[0] + ($bg_darker[0] - $bg_dark[0]) * $ratio);
$g = round($bg_dark[1] + ($bg_darker[1] - $bg_dark[1]) * $ratio);
$b = round($bg_dark[2] + ($bg_darker[2] - $bg_dark[2]) * $ratio);
$color = imagecolorallocate($image, $r, $g, $b);
imagesetpixel($image, $x, $y, $color);
}
}
// Add holiday-colored particles/glow effects
$particle_colors = [
imagecolorallocatealpha($image, $holiday_red[0], $holiday_red[1], $holiday_red[2], 100),
imagecolorallocatealpha($image, $holiday_orange[0], $holiday_orange[1], $holiday_orange[2], 100),
imagecolorallocatealpha($image, $holiday_yellow[0], $holiday_yellow[1], $holiday_yellow[2], 100),
imagecolorallocatealpha($image, $holiday_green[0], $holiday_green[1], $holiday_green[2], 100),
imagecolorallocatealpha($image, $holiday_blue[0], $holiday_blue[1], $holiday_blue[2], 100),
];
// Add glowing particles
$num_particles = 80;
for ($i = 0; $i < $num_particles; $i++) {
$x = rand(0, $width);
$y = rand(0, $height);
$size = rand(3, 8);
$color = $particle_colors[array_rand($particle_colors)];
imagefilledellipse($image, $x, $y, $size, $size, $color);
}
// Try to load SoundStudioPro logo
$logo_paths = [
'assets/images/logo.png',
'assets/images/logos/logo.png',
__DIR__ . '/assets/images/logo.png',
__DIR__ . '/assets/images/logos/logo.png',
];
$logo = null;
$logo_loaded = false;
foreach ($logo_paths as $logo_path) {
if (file_exists($logo_path)) {
$logo = @imagecreatefrompng($logo_path);
if (!$logo) {
$logo = @imagecreatefromjpeg($logo_path);
}
if (!$logo) {
$logo = @imagecreatefromgif($logo_path);
}
if ($logo) {
$logo_loaded = true;
break;
}
}
}
// Define text colors
$text_white = imagecolorallocate($image, 255, 255, 255);
$text_red = imagecolorallocate($image, $holiday_red[0], $holiday_red[1], $holiday_red[2]);
$text_orange = imagecolorallocate($image, $holiday_orange[0], $holiday_orange[1], $holiday_orange[2]);
$text_yellow = imagecolorallocate($image, $holiday_yellow[0], $holiday_yellow[1], $holiday_yellow[2]);
// Font paths (try multiple locations)
$font_paths = [
'assets/fonts/Poppins-Bold.ttf',
'assets/fonts/Inter-Bold.ttf',
__DIR__ . '/assets/fonts/Poppins-Bold.ttf',
__DIR__ . '/assets/fonts/Inter-Bold.ttf',
];
$font_path = null;
foreach ($font_paths as $path) {
if (file_exists($path)) {
$font_path = $path;
break;
}
}
// Position logo at top center if loaded
if ($logo_loaded) {
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
// Scale logo to fit nicely at top
$max_logo_width = 400;
$max_logo_height = 150;
$width_scale = $max_logo_width / $logo_width;
$height_scale = $max_logo_height / $logo_height;
$logo_scale = min($width_scale, $height_scale, 1.0);
$scaled_logo_width = (int)($logo_width * $logo_scale);
$scaled_logo_height = (int)($logo_height * $logo_scale);
// Position logo at top center
$logo_x = (int)(($width - $scaled_logo_width) / 2);
$logo_y = 40;
// Resize logo with transparency
$resized_logo = imagecreatetruecolor($scaled_logo_width, $scaled_logo_height);
imagealphablending($resized_logo, false);
imagesavealpha($resized_logo, true);
$transparent = imagecolorallocatealpha($resized_logo, 0, 0, 0, 127);
imagefill($resized_logo, 0, 0, $transparent);
imagealphablending($resized_logo, true);
imagecopyresampled($resized_logo, $logo, 0, 0, 0, 0, $scaled_logo_width, $scaled_logo_height, $logo_width, $logo_height);
imagealphablending($image, true);
imagecopy($image, $resized_logo, $logo_x, $logo_y, 0, 0, $scaled_logo_width, $scaled_logo_height);
imagedestroy($resized_logo);
imagedestroy($logo);
}
// Add holiday badge text
if ($font_path && function_exists('imagettftext')) {
// Holiday badge
$badge_text = "🎄 Holiday Gift Certificate 🎄";
$badge_size = 32;
$badge_y = $logo_loaded ? 220 : 150;
// Text shadow
$shadow_color = imagecolorallocatealpha($image, 0, 0, 0, 120);
imagettftext($image, $badge_size, 0, 601, $badge_y + 1, $shadow_color, $font_path, $badge_text);
imagettftext($image, $badge_size, 0, 600, $badge_y, $text_orange, $font_path, $badge_text);
// Main title
$title_text = "5 Free Songs";
$title_size = 96;
$title_y = $badge_y + 100;
// Calculate text width for centering
$bbox = imagettfbbox($title_size, 0, $font_path, $title_text);
$title_width = $bbox[4] - $bbox[0];
$title_x = (int)(($width - $title_width) / 2);
// Text shadow for title
imagettftext($image, $title_size, 0, $title_x + 3, $title_y + 3, $shadow_color, $font_path, $title_text);
// Gradient effect for title (using orange to yellow)
imagettftext($image, $title_size, 0, $title_x, $title_y, $text_orange, $font_path, $title_text);
// Subtitle
$subtitle_text = "Create Beautiful Music This Holiday Season";
$subtitle_size = 36;
$subtitle_y = $title_y + 120;
$bbox = imagettfbbox($subtitle_size, 0, $font_path, $subtitle_text);
$subtitle_width = $bbox[4] - $bbox[0];
$subtitle_x = (int)(($width - $subtitle_width) / 2);
imagettftext($image, $subtitle_size, 0, $subtitle_x + 2, $subtitle_y + 2, $shadow_color, $font_path, $subtitle_text);
imagettftext($image, $subtitle_size, 0, $subtitle_x, $subtitle_y, $text_white, $font_path, $subtitle_text);
// Tagline at bottom
$tagline_text = "No credit card required • Start creating instantly";
$tagline_size = 24;
$tagline_y = $height - 40;
$bbox = imagettfbbox($tagline_size, 0, $font_path, $tagline_text);
$tagline_width = $bbox[4] - $bbox[0];
$tagline_x = (int)(($width - $tagline_width) / 2);
$tagline_color = imagecolorallocate($image, 160, 174, 192); // #a0aec0
imagettftext($image, $tagline_size, 0, $tagline_x, $tagline_y, $tagline_color, $font_path, $tagline_text);
} else {
// Fallback to built-in fonts if TTF not available
$y_pos = $logo_loaded ? 220 : 150;
// Add SoundStudioPro text if logo wasn't loaded
if (!$logo_loaded) {
imagestring($image, 5, 450, 80, 'SoundStudioPro', $text_white);
}
imagestring($image, 5, 400, $y_pos, 'Holiday Gift Certificate', $text_orange);
imagestring($image, 5, 500, $y_pos + 80, '5 Free Songs', $text_yellow);
imagestring($image, 4, 300, $y_pos + 160, 'Create Beautiful Music This Holiday Season', $text_white);
}
// Add decorative holiday icons (simple shapes)
$icon_y = $height - 100;
$icon_spacing = 150;
$icon_start_x = ($width - ($icon_spacing * 3)) / 2;
// Gift icon (simple rectangle with bow)
$gift_x = $icon_start_x;
imagefilledrectangle($image, $gift_x - 20, $icon_y - 15, $gift_x + 20, $icon_y + 15, $text_red);
imagefilledellipse($image, $gift_x, $icon_y - 15, 10, 10, $text_yellow);
// Music note (simple shape)
$music_x = $icon_start_x + $icon_spacing;
imagefilledellipse($image, $music_x, $icon_y, 12, 12, $text_orange);
imageline($image, $music_x + 6, $icon_y - 8, $music_x + 6, $icon_y - 20, $text_orange);
// Star
$star_x = $icon_start_x + ($icon_spacing * 2);
$points = [];
for ($i = 0; $i < 5; $i++) {
$angle = ($i * 2 * M_PI / 5) - (M_PI / 2);
$points[] = $star_x + cos($angle) * 15;
$points[] = $icon_y + sin($angle) * 15;
}
imagefilledpolygon($image, $points, 5, $text_yellow);
// Heart
$heart_x = $icon_start_x + ($icon_spacing * 3);
imagefilledellipse($image, $heart_x - 8, $icon_y, 12, 12, $text_red);
imagefilledellipse($image, $heart_x + 8, $icon_y, 12, 12, $text_red);
$heart_points = [
$heart_x, $icon_y + 15,
$heart_x - 12, $icon_y + 5,
$heart_x + 12, $icon_y + 5,
];
imagefilledpolygon($image, $heart_points, 3, $text_red);
// Output the image
imagepng($image);
imagedestroy($image);
?>