<?php | |
if ($handle = opendir('.')) { | |
while (false !== ($entry = readdir($handle))) { | |
if ($entry != "." && $entry != "..") { | |
$fileInfo = explode('.', $entry); | |
$fileName = $fileInfo[0]; | |
$fileExt = $fileInfo[1]; | |
if ($fileExt === 'png') { | |
continue; | |
} | |
echo $entry; | |
exec('dwebp '.$entry.' -o '.$fileName.'.png', $a, $b); | |
if ($b != 0) { | |
echo 'not webp'; | |
} else { | |
exec('convert '.$fileName.'.png '.$entry, $a, $b); | |
if ($b == 0) { | |
echo 'success'; | |
} | |
} | |
echo PHP_EOL; | |
} | |
} | |
closedir($handle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment