This commit is contained in:
Laucha1312
2026-06-04 15:21:19 -03:00
parent df828ddd7c
commit cb11aa5d77
2 changed files with 117 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
$icoPath = 'public/favicon.ico';
$pngPath = 'public/favicon_source.png';
if (!file_exists($icoPath)) {
echo "❌ favicon.ico no encontrado.\n";
exit(1);
}
$data = file_get_contents($icoPath);
$pos = strpos($data, "\x89PNG\r\n\x1a\n");
if ($pos !== false) {
file_put_contents($pngPath, substr($data, $pos));
echo "✅ PNG extraído de favicon.ico y guardado en $pngPath\n";
} else {
// Si no es un PNG-in-ICO, tal vez GD pueda leerlo directamente como string
$img = @imagecreatefromstring($data);
if ($img) {
imagepng($img, $pngPath);
echo "✅ Favicon convertido a PNG en $pngPath\n";
} else {
echo "❌ No se pudo extraer ni convertir el favicon.ico.\n";
exit(1);
}
}