![]() 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/-3e7d33f4/ |
<?php
/**
* Dynamic Favicon Generator
* Serves a favicon from assets/images/og-image.png
* This prevents 404 errors and redirects
*/
// Check if GD library is available
if (!extension_loaded('gd')) {
// Fallback: serve a simple 1x1 transparent PNG
header('Content-Type: image/png');
header('Cache-Control: public, max-age=31536000, immutable');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
exit;
}
// Source image path
$source_image = __DIR__ . '/assets/images/og-image.png';
// Check if source exists
if (!file_exists($source_image)) {
// Fallback: serve a simple 1x1 transparent PNG
header('Content-Type: image/png');
header('Cache-Control: public, max-age=31536000, immutable');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
exit;
}
// Load source image
$source = @imagecreatefrompng($source_image);
if (!$source) {
header('Content-Type: image/png');
header('Cache-Control: public, max-age=31536000, immutable');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
exit;
}
// Create 32x32 favicon
$size = 32;
$favicon = imagecreatetruecolor($size, $size);
// Enable alpha blending
imagealphablending($favicon, false);
imagesavealpha($favicon, true);
// Fill with transparent background
$transparent = imagecolorallocatealpha($favicon, 0, 0, 0, 127);
imagefill($favicon, 0, 0, $transparent);
// Resize source image to favicon size
imagealphablending($favicon, true);
imagecopyresampled($favicon, $source, 0, 0, 0, 0, $size, $size, imagesx($source), imagesy($source));
// Set headers for caching
header('Content-Type: image/png');
header('Cache-Control: public, max-age=31536000, immutable');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($source_image)) . ' GMT');
header('ETag: "' . md5_file($source_image) . '"');
// Output the favicon
imagepng($favicon);
// Clean up
imagedestroy($source);
imagedestroy($favicon);