Please tell me how can I check the file for its real type?
When executing the imagecreatefrompng()
function, it displays an error: is not a valid PNG file
.
mime_content_type()
says image/png
file.
This file...
<?php
$file_name = $_SERVER['DOCUMENT_ROOT']."/walko.png";
$new_file_name = $_SERVER['DOCUMENT_ROOT']."/walko.webp";
$img = imagecreatefrompng($file_name);
imagepalettetotruecolor($img);
imagealphablending($img, true);
imagesavealpha($img, true);
imagewebp($img, $new_file_name);
imagedestroy($img);
?>
PHP 7.4.9