<?php
$sourcePath = 'public/img/Capture__1_-removebg-preview.png';
$destPath = 'public/img/favicon_white.png';

$img = imagecreatefrompng($sourcePath);
// Get dimensions
$width = imagesx($img);
$height = imagesy($img);

// Create a new true color image with the same dimensions
$bg = imagecreatetruecolor($width, $height);

// Allocate a white background color
$white = imagecolorallocate($bg, 255, 255, 255);

// Fill the background with white
imagefill($bg, 0, 0, $white);

// Copy the original transparent image over the white background
imagecopyresampled($bg, $img, 0, 0, 0, 0, $width, $height, $width, $height);

// Save the new image
imagepng($bg, $destPath);
imagedestroy($img);
imagedestroy($bg);

echo "Favicon created.\n";
