34
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user